A Software Engineering Blog

by Nick Holmes

  Home  |   Contact  |   Syndication    |   Login
  11 Posts | 0 Stories | 6 Comments | 0 Trackbacks

News

Archives

Post Categories

In my last two posts, I described how F# transforms functions with more than one argument into chains of functions with a single argument. Strictly speaking, all functions in F# must have exactly one argument, and return exactly one result.  There is a special type, unit, which can be used as a dummy when no argument or return is required, like void in C#.

F#’s functions are lambda functions, formally described by lambda calculus which provides the theoretic model for functional languages. Happily, we don’t all need to be fluent in lambda calculus to use F#. The F# compiler automatically converts functions to these chains of lambda functions in a process called currying. The resulting function is said to be curried - but remember the resulting function is just the first in the chain. The term is named for Haskell Curry - for whom the Haskell language is also named (indeed there is another language called Curry too).

Incidently C#’s lambda expressions are not curried automatically curried, and so its not possible to partially apply them.

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati
posted on Tuesday, May 05, 2009 11:30 AM