Difference between revisions of "Currying"

From Fōrmulæ wiki
Jump to: navigation, search
m
(Description (from Rosetta Code))
 
(2 intermediate revisions by the same user not shown)
Line 3: Line 3:
 
=== Description (from Rosetta Code) ===
 
=== Description (from Rosetta Code) ===
  
'''Task'''
+
{| class="wikitable" style="width:100%;"
 +
| '''Task'''
 
Create a simple demonstrative example of [https://en.wikipedia.org/wiki/Currying Currying] in a specific language.   
 
Create a simple demonstrative example of [https://en.wikipedia.org/wiki/Currying Currying] in a specific language.   
  
 
Add any historic details as to how the feature made its way into the language.
 
Add any historic details as to how the feature made its way into the language.
 +
|}
  
 
=== Example ===
 
=== Example ===
Line 18: Line 20:
 
when a lambda application is called with the same number of arguments, the result is the habitual:
 
when a lambda application is called with the same number of arguments, the result is the habitual:
  
[[File:Currying1.png|border]]
+
[[File:Currying2.png|border]]
  
However, if a less number of parameters is applied, currying is performed:
+
However, if a less number of parameters is applied, currying is performed. Nothe that the result is another lambda expression.
  
[[File:Currying1.png|border]]
+
[[File:Currying3.png|border]]
  
 
=== Historic details ===
 
=== Historic details ===

Latest revision as of 19:49, 22 March 2019

This page is the answer to the task Currying in the Rosetta Code.

Description (from Rosetta Code)

Task

Create a simple demonstrative example of Currying in a specific language.

Add any historic details as to how the feature made its way into the language.

Example

In Fōrmulæ, a lambda application can specify less parameters of its definition. It such a case, a currying is applied, which returns a lambda expression defined with the remaining parameters.

The following is a simple definition of a lambda expression:

Currying1.png

when a lambda application is called with the same number of arguments, the result is the habitual:

Currying2.png

However, if a less number of parameters is applied, currying is performed. Nothe that the result is another lambda expression.

Currying3.png

Historic details

When Fōrmulæ designer created the standard symbolic package the currying operation was not included, because that he thought it was a mere curiosity of lambda expressions and lambda calculus thories. Later, when testing the package, he was trying to create the Church numerals, he realized that currying was needed, so he included it.