[Haskell-cafe] Re: wanted: haskell one-liners (in the perl sense of one-liners)

2007-03-04 Thread Thomas Hartman
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

[Haskell-cafe] Re: wanted: haskell one-liners (in the perl sense of one-liners)

2007-03-07 Thread Thomas Hartman
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

[Haskell-cafe] Re: wanted: haskell one-liners (in the perl sense of one-liners)

2007-03-07 Thread Thomas Hartman
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

[Haskell-cafe] Re: wanted: haskell one-liners (in the perl sense of one-liners)

2007-03-07 Thread Thomas Hartman
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

[Haskell-cafe] Re: wanted: haskell one-liners (in the perl sense of one-liners)

2007-03-07 Thread Thomas Hartman
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

Re: [Haskell-cafe] Re: wanted: haskell one-liners (in the perl sense of one-liners)

2007-03-04 Thread Donald Bruce Stewart
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

Re: [Haskell-cafe] Re: wanted: haskell one-liners (in the perl sense of one-liners)

2007-03-04 Thread Thomas Hartman
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

Re: [Haskell-cafe] Re: wanted: haskell one-liners (in the perl sense of one-liners)

2007-03-04 Thread Donald Bruce Stewart
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. > >

Re: [Haskell-cafe] Re: wanted: haskell one-liners (in the perl sense of one-liners)

2007-03-04 Thread Thomas Hartman
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

Re: [Haskell-cafe] Re: wanted: haskell one-liners (in the perl sense of one-liners)

2007-03-04 Thread Brandon S. Allbery KF8NH
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

Re: [Haskell-cafe] Re: wanted: haskell one-liners (in the perl sense of one-liners)

2007-03-06 Thread Thomas Hartman
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

Re: [Haskell-cafe] Re: wanted: haskell one-liners (in the perl sense of one-liners)

2007-03-06 Thread Thomas Hartman
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

Re: [Haskell-cafe] Re: wanted: haskell one-liners (in the perl sense of one-liners)

2007-03-07 Thread Chris Kuklewicz
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

Re: [Haskell-cafe] Re: wanted: haskell one-liners (in the perl sense of one-liners)

2007-03-20 Thread Thomas Hartman
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

Re: [Haskell-cafe] Re: wanted: haskell one-liners (in the perl sense of one-liners)

2007-03-20 Thread Thomas Hartman
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

Re: [Haskell-cafe] Re: wanted: haskell one-liners (in the perl sense of one-liners)

2007-03-20 Thread Thomas Hartman
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

Re: [Haskell-cafe] Re: wanted: haskell one-liners (in the perl sense of one-liners)

2007-03-20 Thread Dougal Stanton
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

Re: [Haskell-cafe] Re: wanted: haskell one-liners (in the perl sense of one-liners)

2007-03-20 Thread Thomas Hartman
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

Re: [Haskell-cafe] Re: wanted: haskell one-liners (in the perl sense of one-liners)

2007-03-20 Thread Lutz Donnerhacke
* 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

Re: [Haskell-cafe] Re: wanted: haskell one-liners (in the perl sense of one-liners)

2007-03-20 Thread Jules Bean
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 . ( \