To answer my original question, here's a few ways to accomplish what I
wanted with haskell
Perl is still a lot faster than ghc -e, but I guess if you wanted
speed you could compile first.
[EMAIL PROTECTED]:~/learning/haskell/U
In the spirit of making easy things easy, here is a "haskell from
shell" one-line grepper, that uses regexen.
Now, if only I could get pcre-regex installed I would be quite
content. (Still stuck using posix RE for now.)
**
[EMAIL PROTECTED]:~/learning/haskell/UnixTools$ time ./q-wor
with PCRE. now (and yep, it's a lot faster than posix):
***
[EMAIL PROTECTED]:~/learning/haskell/UnixTools$ ./q-words.sh
q
qua
quack
quacked
quackery
quackery's
quacking
quacks
quad
quad's
real0m6.691s
user0m2.460s
Okay, so much for PCRE match.
Can someone show me give me pointers on PCRE replace?
Ideal would be something with all the =~ s/// semantics from perl.
(Not sure if this is included in Text.Regex.PCRE. is it?)
In other words, how to do this with (preferrably) Text.Regex.PCRE ?
Of course in this
Just noticed a comment in
http://www.serpentine.com/blog/2007/02/27/a-haskell-regular-expression-tutorial/
which says there's no perl-like regex replace in the library, and links to
http://hpaste.org/697
which is an attempt at providing one.
Not sure if this is useful or not.
2007/3/7, Thoma
There's some nice one liners bundled with h4sh:
http://www.cse.unsw.edu.au/~dons/h4sh.html
For example:
http://www.cse.unsw.edu.au/~dons/h4sh.txt
If you recall, h4sh is a set of unix wrappers to the list library.
I still use them everyday, though probably should put out a new release
so
That seems like a really great thing to have. But I had troubles installing it.
h4sh depends on hs-plugins.
And...
[EMAIL PROTECTED]:~/haskellInstalls/hs-plugins$ ./Setup.lhs configure
Setup.lhs: Warning: The field "hs-source-dir" is deprecated, please
use hs-source-dirs.
Config
Yes, it definitely is a little lagged. It should be ported to use lazy
bytestrings too. I wsa more suggesting the one liners as examples of
haskell use in the shell.
tphyahoo:
> That seems like a really great thing to have. But I had troubles installing
> it.
>
> h4sh depends on hs-plugins.
>
>
I think I could have most of the oneliner goodness of h4sh, without
having to do the module install, if I could figure out a way to
include modules with ghc -e.
or, alternatively some way to specify modules as a ghc flag, analogous to
perl -MPath::To::Module -e 'commands'
Can this be made to wo
On Mar 4, 2007, at 6:31 , Thomas Hartman wrote:
Setup.lhs: cannot satisfy dependency haskell-src-any
Used to be bundled, now unbundled. On debian/ubuntu check your
libghc6-*-dev packages. (libghc6-haskell-src-dev?)
--
brandon s. allbery[linux,solaris,freebsd,perl] [EMAIL PROTECT
Can't seem to find these packages. Do I need to add another repo? Or
build from source?
[EMAIL PROTECTED]:~/haskellInstalls/hs-plugins$ apt-cache search
libghc6 | grep ^libghc6-haskell
libghc6-haskelldb-dev - Haskell library for expressing database queries
[EMAIL PROTECTED]:~/haskellInstalls/hs-p
quoth brandon allberry in a private message (answering my unintended
private message)
On Mar 7, 2007, at 1:51 , Thomas Hartman wrote:
Can't seem to find these packages. Do I need to add another repo? Or
build from source?
You may have to backport; I found it in feisty (universe) in a quick
s
Thomas Hartman wrote:
> Just noticed a comment in
>
> http://www.serpentine.com/blog/2007/02/27/a-haskell-regular-expression-tutorial/
>
>
> which says there's no perl-like regex replace in the library, and links to
>
> http://hpaste.org/697
>
> which is an attempt at providing one.
>
> Not s
Just thought I'd add another potentially helpful bit to this oneliner
/ shell scripting thread. Though to be fair, this perhaps strains the
definition of "one" in "one liner".
This takes a long file containing mostly numerical data, filters out
the numerical data, and sorts it numerically. (Not t
To answer my own post, the Data.List.sort *is* necessary.
Otherwise, you get alphabetic sort.
2007/3/20, Thomas Hartman <[EMAIL PROTECTED]>:
Just thought I'd add another potentially helpful bit to this oneliner
/ shell scripting thread. Though to be fair, this perhaps strains the
definition of
Same thing, but with better comments and whitespace.
[EMAIL PROTECTED]:~/learning/haskell/UnixTools>head -n30 sortNumeric.sh
cat out_select_char_length_csv.out | ghc -e '
interact $
unlines
-- take 10 from the end
-- more efficient than
-- reverse . take 10 . reverse
Quoth Thomas Hartman, nevermore,
> This takes a long file containing mostly numerical data, filters out
> the numerical data, and sorts it numerically. (Not the same thing as
> sorting alphabetically, which is what you get by default, or using the
> unix sort utility). Maybe there's some flag to ma
You contributed
#12:14 < Thunder> @pl \s -> drop (length s - n) s
#12:14 < lambdabot> drop =<< subtract n . length
But, on second thought, 1) I can't use this as a drop-in replacement
for the non points free (right term?) version, and 2) I don't really
understand it.
Still, I would be curious t
* Thomas Hartman wrote:
> You contributed
>
> #12:14 < Thunder> @pl s -> drop (length s - n) s
> #12:14 < lambdabot> drop =<< subtract n . length
>
> But, on second thought, 1) I can't use this as a drop-in replacement
> for the non points free (right term?) version, and 2) I don't really
> underst
Thomas Hartman wrote:
To answer my own post, the Data.List.sort *is* necessary.
Otherwise, you get alphabetic sort.
Which is why you do the Set trick at a different stage in the process,
like this:
interact $
unlines
. map show
-- more efficient than -- reverse . take 10 . reverse
. ( \
20 matches
Mail list logo