Personal tools

User:WillNess

From HaskellWiki

(Difference between revisions)
Jump to: navigation, search
 
Line 1: Line 1:
 
I am a newbie, interested in Haskell.
 
I am a newbie, interested in Haskell.
  +
  +
I like ''this'':
  +
  +
<haskell>
  +
primes = 2 : 3 : ([5,7..] `minus`
  +
foldi (\x:xs -> (x:) . union xs)
  +
[[p*p,p*p+2*p..] | p <- tail primes])
  +
</haskell>
  +
  +
<code>foldi</code> is on [[Fold#Tree-like_folds|Tree-like folds]]. More at [[Prime numbers]].

Revision as of 14:36, 23 June 2011

I am a newbie, interested in Haskell.

I like this:

primes = 2 : 3 : ([5,7..] `minus`
                     foldi (\x:xs -> (x:) . union xs)
                           [[p*p,p*p+2*p..] | p <- tail primes])

foldi is on Tree-like folds. More at Prime numbers.