#haskell - Fri 9 Mar 2007 between 02:42 and 02:58

NY Lost Funds



faxlet add a b = [a..] !! b in let mul a b = map (add a) [b..] !! b in mul 5 3
> let add a b = [a..] !! b in let mul a b = map (add a) [b..] !! b in mul 5 3
lambdabot11
faxhm :/
> let add a b = [a..] !! b in let mul a b = (map (add a) [b..]) !! b in mul 5 3
lambdabot11
faxwhat
rashakil5 + 3 + 3 = 11
faxoh
rashakil> let add a b = [a..] !! b in let mul a b = iterate (add a) 0 !! b in mul 5 3
lambdabot15
faxyes :D
> let add a b = [a..] !! b in let mul a b = iterate (add a) 0 !! b in let factorial a = (foldr mul (map (mul a) [0..])) in factorial 4
lambdabotCouldn't match expected type `Int' against inferred type `[Int]'
fax:S
> let add a b = [a..] !! b in let mul a b = iterate (add a) 0 !! b in let factorial a = foldr mul 1 [1..a] in factorial 4
lambdabot24
rashakil> let add a b = [a..] !! b in let mul a b = map (add a) [b..] !! b in let factorial a = product [1..a] in let product = foldl add 3.14 in factorial 4
lambdabot24
fax:O
3.14 ?!?!
rashakilfor better accuracy, use 3.142
faxwhat is that
wtf :D
mul and product are never used
so you can change them to anything?
> let add a b = [a..] !! b in let mul a b = iterate (add a) 0 !! b in let factorial a = foldr mul 1 [1..a] in factorial 5
lambdabot120
fax> let add a b = [a..] !! b in let mul a b = iterate (add a) 0 !! b in let factorial a = foldr mul 1 [1..a] in factorial 6
lambdabot720
fax> let add a b = [a..] !! b in let mul a b = iterate (add a) 0 !! b in let factorial a = foldr mul 1 [1..a] in factorial 10
lambdabotTerminated
faxahaha
can you define a function which is applied like, "5 f" ?
rashakil> let (!) x = product [1..x] in (5 !)
lambdabot120
faxcool
rashakilThat's not really Haskell though.
faxno?
why nt?

Page: 4 11 18 25 32 39 46 53 60 67 74 81 88 95 

IrcArchive

NY Lost Funds