Linked by Jared White on Thu 24th Apr 2003 17:49 UTC
Permalink for comment
To read all comments associated with this story, please click here.
To read all comments associated with this story, please click here.
News
Linked by Thom Holwerda on 05/23/13 23:22 UTC
Linked by Thom Holwerda on 05/23/13 22:04 UTC
Linked by Thom Holwerda on 05/23/13 22:01 UTC
Linked by Thom Holwerda on 05/23/13 17:52 UTC
Linked by Thom Holwerda on 05/22/13 22:23 UTC
Linked by Thom Holwerda on 05/22/13 13:38 UTC
Linked by Thom Holwerda on 05/22/13 13:30 UTC, submitted by JRepin
Linked by Thom Holwerda on 05/21/13 22:06 UTC
Linked by Thom Holwerda on 05/21/13 21:45 UTC
Linked by Thom Holwerda on 05/21/13 15:53 UTC
More News »
Sponsored Links



Optional named arguments are also provided by OCaml and Ada95.
As with Python, they are particularly useful when you have default values.
In OCaml, there is the additional benefit that you can perform a partial application specifying parameters other than the first one. A brief explanation - given an f : 'a -> 'b -> 'c, you can only do f x to get a function 'b -> 'c, but with f : x:'a -> y:'b -> 'c you can say f ~y:y to get a function x:'a -> 'c . Obviously, you could always use (fun y -> f x y) but the shorthand is convenient. In simpler terms, if you apply a function without giving all the arguments, the result is a function taking the remaining arguments. Without named arguments you can only give arguments in order.