Curried anonymous function in SML

jjennifer picture jjennifer · Mar 13, 2010 · Viewed 11.7k times · Source

I have the function below and it works:

(fn x => x * 2) 2; 

but this one doesn't work:

(fn x y => x + y ) 2 3;

Can anyone tell me why? Or give me some hint to get it to work?

Answer

sepp2k picture sepp2k · Mar 13, 2010

(fn x => fn y => x+y) 2 3; works. fn simply doesn't have the same syntactic sugar to define curried functions that fun has.