Your skill will accomplish what the force of many cannot |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Currying in a functional language (as others have pointed out above) is automatic within the language. This is because in most functional languages, a function is only allowed to accept one argument. Syntactic sugar under the hood will convert a multi-parameter function like this (using pseudo-functional-perl): into something like this: and then function application like this: into this: This is even more obvious in the type signatures of functions in languages like OCaml or Haskell. For instance, the above foo function would have the type signature in OCaml: Which basically can be read as "a function which takes an int, which returns a function, which also takes an int, which then returns an int". So, to answer your question more directly, using currying in a language like Perl has (at best) only obscure usages. But in a functional language like Standard ML, OCaml or Haskell it is a fundemental part of how the language actually works.
-stvn
In reply to Re: Currying--useful examples?
by stvn
|
|