Curried anonymous function in SML

前端 未结 3 565
Happy的楠姐
Happy的楠姐 2021-02-07 02:55

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;
         


        
3条回答
  •  生来不讨喜
    2021-02-07 03:47

    (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.

提交回复
热议问题