jznsis
> Wouldn't that be like if in C, you had to write the arguments in reverse order of the format string, like this?
Exactly and that's not what we want
Let's go through this step by step:
sprintf "%s %d" returns a function, taking a string and returning a function taking an integer and returning a string, right?
sprintf "%s %d" "hello" returns a function taking an integer, returning a string, right?
sprintf "%s %d" "hello" 42 returns a string, right?
Thus my intuition of the return type of sprintf "%s %d" would be string -> (int -> string) not int -> (string -> string)
Either way, the format string discussion for the printf familiy of functions is very similar between them
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?
I know it's supposed to be pseudo code and most likely it's something like sprintf "% world %d" "hello" 42 but I got a little confused by the type list being backwards from what I expected