#haskell - Tue 6 Mar 2007 between 00:48 and 00:51

NY Lost Funds



lambdabotForeign.Marshal.Error.throwIf :: (a -> Bool) -> (a -> String) -> IO a -> IO a
jaredjwkh, that's a good one. unlike this fix flippy flip thing.
araujoQtPlatypus, you can make more concise code
slowriot... get it? hyuk hyuk hyuk
fax> let pacman n x y = if n<0 then x else pacman n-1 x+y
lambdabotParse error
fax:(
LoganCapaldo@type let if' a b c = case a of { True -> b ; False -> c } in (fix (flip flip 1 . liftM2 if' (> 0) . ap (*) . (. subtract 1)))
lambdabotforall c. (Ord c, Num c) => c -> c
fax> let pacman n x y = if n<0 then x else (pacman (n-1) (x+y))
lambdabotParse error
faxcan I do this?
jcreighQtPlatypus: but it's nice to be able to say, eg, filter (not . isDigit) xs without having to say "filter (\x -> not (isDigit x)) xs" (small example, I know)
chessguyfax apparently not
faxLOL
can it be done?
wkhfax: you're calling a 3-parameter function with 2 parameters
faxwkh: I want to curry
QtPlatypus> 143.00 / 1.1
lambdabot130.0
dolioYou're missing the "in" portion of the let expression.
mwcfax, it can be done, but lambdabot want's in's as part of its toplevel
rahikkalaQtPlatypus: Also, along with fix, you can use it to produce amusingly powerful Haskell golf oneliners
mwc> let foo = 5
lambdabotParse error
mwc>let foo = 5 in foo
chessguyfax, you can't return two different types in two different cases
faxwhat do I need for in
> let pacman n x y = if n<0 then x else (pacman) (n-1) (x+y) in pacman 3 1 2 3
wkhyou just type let <decl> in <expr>
lambdabotOccurs check: cannot construct the infinite type: t = t1 -> t
Probab...
chessguyfax, you're returning x in one case, and a function in another
faxyes thats why I use Either
allbery_ban invcation of pacman, presumably, since you defined it presumably with intent to use it
faxpacman :: Either (a -> b) Int
LoganCapaldoyou have to actually use either :)
jaredjfax: let pacman n x y = if n<0 then Left x else Right $ (pacman) (n-1) (x+y)
think i got the $ right
fax:S

Page: 2 9 16 23 30 37 44 51 58 65 72 79 86 93 100 107 114 121 128 135 142 

IrcArchive

NY Lost Funds