At 13:27 03-04-02 +0100, D. Tweed wrote: >On Wed, 3 Apr 2002, Michal Wallace wrote: > > > module Main where > > alphabet = "abcdefghijklmnopqrstuvwxyz" > > count ch str = length [c | c <- str , c == ch] > > hist str = [count letter str | letter <- alphabet] > > oneline ch str = [ch] ++ " " ++ stars (count ch str) > > stars x = if x == 0 > > then "" > > else "*" ++ stars ( x - 1 ) > > report str ch = do putStrLn ( oneline ch str ) > > loop f (h:t) = if t == [] > > then f h > > else do f h > > loop f t > > main = do content <- getContents > > let rpt letter = report content letter > > loop rpt alphabet > > """ > > > > Other than ignoring upper case letters, and being really > > really slow, it seems to work fine in hugs.... > >I'm a bit confused how this can have worked... in Haskell `let' is used in >the context of a `let ..<1>.. in ..<2>..' where the code ellided in <1> >binds some names to values which are then used in the expression <2> (as >in `let x=sqrt 2 in exp x') and so the contents of main isn't (unless I'm >missing something) syntactically Haskell.
It's correct Haskell. Have a look at http://www.haskell.org/onlinereport/exps.html#sect3.14 Rijk-Jan _______________________________________________ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe