July 31, 2013
8:38 a.m.
On 2013-07-31, at 08:37 , Haoyi Li wrote:
I'd like multiline lambdas too, but the syntax is a thorny problem. F# is the only language I know (are there others?) that allows you to mix whitespace-delimited and paren-delimited expressions, e.g. with whitespace-blocks inside parens:
let f n = n + ( if n % 2 = 0 then printf "lol" 1 else printf "omg" 2 )
Haskell can do that: f n = n + ( case n `mod` 2 of 0 -> unsafePerformIO $ do putStrLn "lol" return 1 1 -> unsafePerformIO $ do putStrLn "omfg" return 2 ) although a difference is that it doesn't have statement blocks, only expressions (`do` blocks are sugar for monadic chain expressions)