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

Halp /prog/ :(

Name: Anonymous 2010-04-22 21:19

Well my professor is doing a chapter over functional languages and he decided he wanted us to try something new. He wants us to program a couple things up in haskell.

I don't know shit about haskell and I've never even touched a functional language, but he expects us to know everything about them for some reason.

does /prog/ know anything helpful about haskell? :(

Name: Anonymous 2010-04-23 2:40

floop.hs:

boop foop gee goop       = foop goop (gee goop)
ping goop zoom           = goop
oot foop gee goop        = foop (gee goop)
pop foop gee goop        = foop goop gee
zoom foop                = foop (zoom foop)
cond bloop foop gee goop = if bloop goop then foop goop else gee goop
floop  = zoom (oot (cond ((==) 0) (ping 1)) (oot (boop (*)) (pop oot pred)))

Execution:

$ ghci floop.hs
[1 of 1] Compiling Main             ( floop.hs, interpreted )
Ok, modules loaded: Main.
*Main> let factorial = floop
*Main> map factorial (take 10 [1..])
[1,2,6,24,120,720,5040,40320,362880,3628800]

Name: Anonymous 2010-04-23 12:56

floop.hs
❤_❤

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