Hannah Schroeter wrote:
>
> Hello!
>
> On Mon, May 31, 1999 at 06:01:31PM +0200, Friedrich Dominicus wrote:
> > Hannah Schroeter wrote:
>
> > > Hello!
>
> > > On Fri, May 28, 1999 at 08:00:27AM +0200, Friedrich Dominicus wrote:
> > > > I wrote before with my trouble understanding hugsIsEOF. Bu
Hello!
On Tue, Jun 01, 1999 at 06:58:32AM +0200, Friedrich Dominicus wrote:
> [...]
> I want to do the following, read a file line by line and finding out
> which line is longer than x-chars. I want to print out which lines are
> so long. I think that can just be done line-wise.
> Thanks for yo
Hannah Schroeter wrote:
> [...] So, still no need to fuzz with file handles :-)
... and no need to fuzz with intermediate names, either. :-) If you
define an operator for reversed function composition
(.|) = flip (.)
and read it like a pipe in *nix, you get a one-liner:
longerThan fn len
Hannah Schroeter wrote:
>
> Hello!
>
> On Tue, Jun 01, 1999 at 06:58:32AM +0200, Friedrich Dominicus wrote:
> > [...]
>
> > I want to do the following, read a file line by line and finding out
> > which line is longer than x-chars. I want to print out which lines are
> > so long. I think that c
It would be nice if the prelude defined more general functions like:
> splitStr c s = left:case right of [] -> []; otherwise -> splitStr c (tail right)
> where (left,right)=span (/=c) s
> joinStr c l = case l of []-> []; otherwise -> foldl1 (\x y->x++c:y) l
The implementation of lines and unli
Friedrich Dominicus wrote:
>[...] How can I combine the output with a line-number can I put that
> into the filter? Or do I have to found another solution?
Don't fear! Mr. One-Liner comes to the rescue:;-)
longerThan fn lenlim = readFile fn >>= lines .| filter (length .| (>lenlim)) .| zip
Sven Panne wrote:
>
> Friedrich Dominicus wrote:
> >[...] How can I combine the output with a line-number can I put that
> > into the filter? Or do I have to found another solution?
>
> Don't fear! Mr. One-Liner comes to the rescue:;-)
>
>longerThan fn lenlim = readFile fn >>= lines .|
Keith Wansbrough wrote:
>
> Sven Panne wrote:
>
> > > Don't fear! Mr. One-Liner comes to the rescue:;-)
> > >
> > >longerThan fn lenlim = readFile fn >>= lines .| filter (length .| (>lenlim))
>.| zip [1..] .| map (\(n,l) -> shows n ") " ++ l) .| unlines .| putStr
>
> Friedrich wrote:
>
> Date: Tue, 01 Jun 1999 17:32:22 +0200
> From: Sven Panne <[EMAIL PROTECTED]>
> Don't fear! Mr. One-Liner comes to the rescue:;-)
>
>longerThan fn lenlim = readFile fn >>= lines .| filter (length .| (>lenlim)) .|
>zip [1..] .| map (\(n,l) -> shows n ") " ++ l) .| unlines .| putStr
Are
~c [EMAIL PROTECTED]
~r Readme
~e
Keith Wansbrough wrote:
> Sven Panne wrote:
>
> > > Don't fear! Mr. One-Liner comes to the rescue:;-)
> > >
> > >longerThan fn lenlim = readFile fn >>= lines .| filter (length .| (>lenlim))
>.| zip [1..] .| map (\(n,l) -> shows n ") " ++ l) .| unlines .| putStr
>
> Friedrich wrote:
>
> >
On Tue, 1 Jun 1999, Sven Panne wrote:
> Friedrich Dominicus wrote:
> >[...] How can I combine the output with a line-number can I put that
> > into the filter? Or do I have to found another solution?
>
> Don't fear! Mr. One-Liner comes to the rescue:;-)
How about initiating Haskel
Kevin Atkinson wrote:
>
> For those of you who may be interested:
>
> I am working on an implementation of Nameable Type Parameters written in
> Haskell. I currently have them working in a so called Mini Haskell
> where all kind information is presented explicitly. I had a few
> unification pr
Sven Panne wrote:
> > Don't fear! Mr. One-Liner comes to the rescue:;-)
> >
> >longerThan fn lenlim = readFile fn >>= lines .| filter (length .| (>lenlim)) .|
>zip [1..] .| map (\(n,l) -> shows n ") " ++ l) .| unlines .| putStr
Friedrich wrote:
> Do you want to drive me away from lear
__ __ __ __ ___ _
|| || || || || || ||__ Hugs 98: Based on the Haskell 98 Standard
||___|| ||__|| ||__|| __||Copyright (c) 1994-1999
||---|| ___|| World Wide Web: http://haskell.org/hugs
|| ||
15 matches
Mail list logo