|
Since the normal style of programming in ML uses Curried functions, it makes the most sense to let your ML functions be Curried versions of the Scheme functions. That is, let all ML functions take one argument, but they will typically return functions that take additional arguments.
For example, in Scheme we define
or, equivalently, by
The most natural thing in ML is to define apply as a 1-argument function that returns a 1-argument function. The beginning of such a definition looks like
We often think that this ML version of apply is a 2-argument function, but technically it's not. Since ML systematically represents multiple-argument functions by 1-argument higher-order functions, we usually don't get very excited about the difference. The Curried ML version of apply can do everything that the Scheme version can, plus a bit more, so it seems like a fair translation.
Mike O'D. |
to: