- cross-posted to:
- [email protected]
- [email protected]
- cross-posted to:
- [email protected]
- [email protected]
Made with KolourPaint and screenshots from Kate (with the GitHub theme).
Made with KolourPaint and screenshots from Kate (with the GitHub theme).
Both of those declarations look weird to me. In Haskell it would be:
a :: Stringbob :: (String, Int, Double) -> [String]bob (a, b, c) = ...
… except that makes
bob
a function taking a tuple and it’s much more idiomatic to curry it instead:bob :: String -> Int -> Double -> [String]bob a b c = ...-- syntactic sugar for:-- bob = \a -> \b -> \c -> ...
The
[T]
syntax also has a prefix form[] T
, so[String]
could also be written[] String
.OCaml makes the opposite choice. In OCaml, a list of strings would be written
string list
, and a set of lists of strings would bestring list set
, a list of lists of integersint list list
, etc.