Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

ITT we conjure the spirits with our dog

Name: Anonymous 2008-10-11 10:39

mymap :: ( a -> b ) -> [a] -> [b]
mymap fn [] = []
mymap fn list = (fn (head list)) : (mymap fn (tail list))


qsort []     = []
qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++ qsort (filter (>= x) xs)


Holy Sussman I can see FOREVER

Name: Anonymous 2008-10-12 9:34

primeSieve n = sieve 3 (listArray (1, n) (False : True : cycle [True, False]) :: UArray Integer Bool)
  where sieve i a
          | i > limit = a
          | a ! i     = sieve (i + 1) a'
          | otherwise = sieve (i + 1) a
          where a' = a // zip [i * i, i * i + 2 * i .. n] (repeat False)
        limit = floor (sqrt (fromInteger n))

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List