Joy (programming language): Difference between revisions

Content deleted Content added
Tags: Mobile edit Mobile web edit
Tags: Mobile edit Mobile web edit
Line 18:
The '''Joy programming language''' in [[computer science]] is a [[purely functional programming language]] that was produced by Manfred von Thun of [[La Trobe University]] in [[Melbourne]], [[Australia]]. Joy is based on composition of functions rather than [[lambda calculus]]. It has turned out to have many similarities to [[Forth (programming language)|Forth]], due not to design but to a sort of parallel evolution and convergence. It was also inspired by the [[Function-level programming|function-level programming style]] of [[John Backus]]'s [[FP (programming language)|FP]].<ref>{{cite web|title=A Conversation with Manfred von Thun|author=Manfred von Thun|url=http://www.nsl.com/papers/interview.htm|accessdate=May 31, 2013|date=December 12, 2003|quote=" In the early 1980s I came across the famous Backus paper "Can programming be liberated from the von Neumann style," and I was immediately intrigued by the higher level of programming in his FP."}}</ref>
 
== How itIt worksWorks ==
 
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]]):
 
Line 28 ⟶ 29:
</syntaxhighlight>
 
The variable x is a parameter which is replaced by the argument to be squared when the function is called.

In a [[functional programming|functional]] language ([[Scheme (programming language)|Scheme]]), the same function could be defined:
 
<syntaxhighlight lang="scheme">
Line 36 ⟶ 39:
</syntaxhighlight>
 
This is different in many ways, but it still uses the parameter x in the same way.

In Joy, the square function is defined:
 
DEFINE square == dup * .