4 ms·
Some reasonable, but I see a new inconsistency here. Shouldn't fn foo(fn (int) -> string) be more consistent?
by tapirl 7y ago
Some reasonable, but I see a new inconsistency here. Shouldn't
fn foo(fn (int) -> string)
be more consistent?
- atombender 7y agoIt's not inconsistent, just terser. You could say that "fn" declares a function by name; the type of foo is int -> str. In Haskell, this is written: foo :: int -> str Of course, Haskell is based on lambda calculus, so multiple arguments are just a generalization of partial function application: foo :: int -> int -> str (A function taking two int arguments and returning a string, which is indistinguishable from a function that takes a single int and returns a function that takes a single int and returns a string.)
- tapirl 7y agoAh, looks both have their own rationality. ":" is ok for single-value returns. AS3 also uses ":". The Haskell language looks interesting. Maybe I should spend some time to study it.