[Haskell-cafe] Cal, Clojure, Groovy, Haskell, OCaml, etc.
Michael Snoyman
michael at snoyman.com
Wed Sep 30 12:52:45 EDT 2009
- Previous message: [Haskell-cafe] Cal, Clojure, Groovy, Haskell, OCaml, etc.
- Next message: [Haskell-cafe] Cal, Clojure, Groovy, Haskell, OCaml, etc.
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
On Wed, Sep 30, 2009 at 6:45 PM, namekuseijin <namekuseijin at gmail.com>wrote:
> On Mon, Sep 28, 2009 at 11:50 PM, Hong Yang <hyangfji at gmail.com> wrote:
> > learn and use. In my humble opinion, Haskell has a lot of libraries, but
> > most of them offer few examples of how to use the modules. In this
> regards,
> > Perl is much much better.
>
> The Perl call is spot on. Specially because Haskell has been
> incorporating so much syntatic sugar that it's almost looking Perlish
> noise already:
>
> import Data.Array.Diff
> import Data.IArray
>
> update :: (Char -> [Int]) -> DiffArray Int ModP -> Char -> DiffArray Int
> ModP
> update lookup arr c = arr // (map calc . lookup $ c)
> where
> calc i = (i, (arr ! i) + (arr ! (i-1)))
>
> solve line sol = (foldl' (update lookup) iArray line) ! snd (bounds iArray)
> where
> iArray = listArray (0, length sol) $ 1 : map (const 0) sol
> lookup c = map (+1) . findIndices (== c) $ sol
>
>
> I've not been following Haskell too much and am completely lost when
> reading code like that. I understand (+1), : and ! but what the hell
> are . and $ for?
> And that weird monad symbol in the Haskell logo is not even used! >>=
> Not quite the worst example of such line noise much of Haskell
> idiomatic code uses nowadays, though.
>
> Point is: >>= . $ : ! `` and meaningful whitespace are all nice
> shortcuts, but also hairy confusing...
>
>
I overall agree with the sentiment (I avoid declaring operators at all
costs), but the example is a bad one. $, ., and >>= are all very basic to
Haskell, and should be picked up almost immediately. As far as becoming line
noise like Perl, well, I happen to like Perl :).
Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090930/99b15da8/attachment.html
- Previous message: [Haskell-cafe] Cal, Clojure, Groovy, Haskell, OCaml, etc.
- Next message: [Haskell-cafe] Cal, Clojure, Groovy, Haskell, OCaml, etc.
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Haskell-Cafe
mailing list