3 ms·
F# uses significant whitespace? I didn't know that. What does it use it for? SML and (I think) Ocaml don't, and I had assumed F# was like Ocaml, since its synt
by cannam 7y ago
F# uses significant whitespace? I didn't know that. What does it use it for?
SML and (I think) Ocaml don't, and I had assumed F# was like Ocaml, since its syntax is largely the same. In the tiny bit of F# I tried writing once I don't remember having had to pay any attention to whitespace.
Significant whitespace is one of the things I didn't enjoy about Haskell and Idris. Life's too short to indent code by hand.
- _bxg1 7y agoI didn't think Haskell had significant whitespace; it doesn't have blocks really, and nested expressions can be wrapped in parentheses, right?
- jeremyjh 7y agoWhitespace is significant in Haskell. In do notation and other forms, you have blocks. You can actually use braces and semi-colons instead but I've never seen that except in some very short one-liners. https://en.wikibooks.org/wiki/Haskell/Indentation https://en.wikibooks.org/wiki/Haskell/Indentation
- desert_boi 7y agoBlocks are handled via indentation. let function1() = for i in 1 .. 10 do printf "%d " i printfn "" function1() borrowed from https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/loops-for-in-expression https://docs.microsoft.com/en-us/dotnet/fsharp/language-refe...