
Chaddaï Fouché wrote:
On Sat, Apr 4, 2009 at 5:20 AM, Zachary Turner
wrote: With Conal's semantic editor combinators
http://conal.net/blog/posts/semantic-editor-combinators/
it would be written as
trueIndices = (result . result) (map fst . filter snd . zip [0..]) (zipWith (&&))
That was a pretty interesting blog post, and easily understandable which is always nice. Thanks for the link. I also had never even used the zipWith function, so thanks for pointing out that equivalence.
I'm not sure you really want to write this pointfree... Generally I tend to avoid it when there's two arguments of identical standing. Also the (map fst . filter snd...) is a Data.List function (findIndices) :
trueIndices xs ys = findindices id $ zipWith (&&) xs ys
I love the pointfree style and it might be a good exercise to try and transcribe any function to pointfree, but sometimes pointful is just clearer.
Or to put it differently, sometimes "pointfree is pointless" ;-) /M -- Magnus Therning (OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus@therning.org http://therning.org/magnus identi.ca|twitter: magthe Haskell is an even 'redder' pill than Lisp or Scheme. -- PaulPotts