Joy (programming language)

From Bauman National Library
This page was last modified on 21 May 2016, at 23:43.
Paradigm multiparadigmality function, concatenation, stack
Developer Manfred von Thunf
First appeared 2001
Typing discipline strong dynamic
Website None
Influenced by
Scheme, C
Factor, Cat, V, Trith

Joy - a functional language developed by Manfred von Thun of La Trobe University In Melbourne, Australia. Joy functions based on the composition, rather than the lambda calculus. It is a language akin to the Fort, although it is not its direct successor. Currently Joy is considered the canonical example of a concatenation of the programming language.


Function of erecting a square defined as:

DEFINE square == dup *.

 The Joy everything is a function that takes a stack as an argument and returns a stack as a result. For example, the number "5" is not an integer constant, and the short program put the number 5 on the stack.

  • Dup operator simply duplicates the top element in the stack, putting to him a copy.
  • Operator * takes the stack top two elements and puts them to work.

  Thus the function of squaring simply duplicates the top item and then multiplies it to yourself samoё, formal parameters are not needed. This makes Joy concise. Defining quick sort:

 DEFINE qsort ==
   [Uncons [>] split]
   [[Swap] dip cons concat]

«Binrec» - one of the many existing Joy recursive combinators, implementing a binary recursion. He expects the presence of software on a stack of four literals, which are:

  • Termination condition (if "small" list (1 or 0 elements) it is already sorted)
  • What if the termination condition is satisfied,
  • What to do by default (to divide the list into two halves by comparing each element with a reference point)
  • What to do at the end.

External links

  1. joy
  2. joy mirror