17 May 00:10
Re: Re: Write Haskell as fast as C.
From: Dan Weston <westondan <at> imageworks.com>
Subject: Re: Re: Write Haskell as fast as C.
Newsgroups: gmane.comp.lang.haskell.cafe
Date: 2008-05-16 22:10:09 GMT
Subject: Re: Re: Write Haskell as fast as C.
Newsgroups: gmane.comp.lang.haskell.cafe
Date: 2008-05-16 22:10:09 GMT
Dan Weston wrote: > Ketil Malde wrote: >>> mkAnn :: ByteString -> Annotation >>> mkAnn = pick . B.words >>> where pick (_db:up:rest) = pick' up $ getGo rest >>> pick' up' (go:_:ev:_) = Ann (B.copy up') (read $ B.unpack >>> go) (read $ B.unpack ev) >>> getGo = dropWhile (not . B.isPrefixOf (pack "GO:")) > > It seems at first face miraculously coincidental that the dropWhile in > the getGo definition knows to stop dropping when there are exactly 4 > elements, in order to match the pattern in the second parameter of the > pick' definition, whose argument is provided by (getGo Rest). > > What magic makes this true? Just curious... I didn't mean "exactly 4", but "at least 3". Otherwise, I'm still curious! :)
RSS Feed