|
|
|
|
|
by jznsis
758 days ago
|
|
I'm not that familiar with syntax of functional programming languages. Isn't Int -> String -> String a shorthand for Int -> (String -> String)? Thus I would have assumed the first argument to the result of sprintf "%s %d" would be an integer, then a string and the final result would be a string. But the invocation would be sprintf "%s %d" "hello" 42, wouldn't it? |
|
Yes. Though I find it more convenient think of it as a function with multiple arguments and not a function that returns another function.
> Thus I would have assumed the first argument to the result of sprintf "%s %d" would be an integer, then a string and the final result would be a string.
Why assume that? (Not rhetorical.) Wouldn't that be like if in C, you had to write the arguments in reverse order of the format string, like this?