Joy (programming language): Difference between revisions

Content deleted Content added
m Task 70: Update syntaxhighlight tags - remove use of deprecated <source> tags
Line 21:
Joy is unusual (except for [[function-level programming]] languages and some esoteric ones, such as [[unlambda]]) in its lack of a [[lambda calculus|lambda]] operator, and therefore lack of [[Parameter (computer science)|formal parameters]]. To illustrate this with a common example, here is how the square function might be defined in an [[imperative programming language]] ([[C (programming language)|C]]):
 
<sourcesyntaxhighlight lang="C">
int square(int x)
{
return x * x;
}
</syntaxhighlight>
</source>
 
The variable x is a formal parameter which is replaced by the actual value to be squared when the function is called. In a [[functional programming|functional]] language ([[Scheme (programming language)|Scheme]]) the same function could be defined:
 
<sourcesyntaxhighlight lang="scheme">
(define square
(lambda (x)
(* x x)))
</syntaxhighlight>
</source>
 
This is different in many ways, but it still uses the formal parameter x in the same way. In Joy the square function is defined: