Joy Language

Joy is a purely functional programming language devised by ManfredVonThun. Whereas all other functional programming languages are based on the application of functions to arguments, Joy is based on the composition of functions. Every Joy function is unary, taking a stack as argument and producing a stack as value. Consequently much of Joy looks like ordinary postfix notation. In Joy's syntax, composition of functions is simply concatenation of the text of the functions. For this reason, Joy can be referred to as a ConcatenativeLanguage.

See http://www.latrobe.edu.au/phimvt/joy.html (Official site), but also mirrored (mostly) at http://www.kevinalbrecht.com/code/joy-mirror/


So, for example, in the program fragment

3 4 +

3 denotes the function which pushes 3 onto a stack, similarly for 4, and + denotes the function which replaces the top two values on a stack with their sum. 3 4 + is their composition [which in traditional mathematical notation might be denoted "lambda s . +(4(3(s)))"], and is equivalent to the function 7.

-- ThomasColthurst


something I wrote.. which I'm not quite sure is correct.

 (* x y percent approxEqual *)
 DEFINE approxEqual == 100.0 / rotate [0 =] [pop] [dup rolldown - swap /] ifte > .

-- ShaeErisson


So... was the language so named because it's a joy to use, or was it named after BillJoy?

-- ScottJohnson


It algebraic properties are so clean that I argue that either Joy or a Joy derivative must cosmically speaking rule the programming world.

Why?

  1. If it's easy to do program proving, it is easy to write bug free programs.
  2. If it's supremely simple to programatically manipulate, then many powerful tools to lint, debug, inspect, instrument, refactor it will evolve.


JoyLanguage is kind of a cross between ForthLanguage and LispLanguage. Like Lisp, lists are a key data structures, and a program can be represented by a list. Unlike Lisp (and like Forth), a program stack is used for argument passing/return, and also replaces let-bindings and the like. So there are no "variable names" in JoyLanguage.

JoyLanguage also provides support for many of the different combinators (see EssAndKayCombinators); it could be viewed as a usable big brother to UnLambdaLanguage.

It still is in the experimental stage, however... for instance, it has a set datatype (which is first-class); but the only things which can be stored in a set are the integers from 0-31. A bit of BrainDeath? that comes straight out of PascalLanguage.

I think JoyLanguage is theoretically important. On the other hand, I'm not a big fan of StackBasedLanguages for use as a source language -- see that page for the reasons why.

-- ScottJohnson

A somewhat more mature implementation of the principles in JoyLanguage can be found in FactorLanguage (http://factor.sf.net)

I disagree, Joy is concatenative, Factor is only somewhat so. Concatenative means that you can cut code on any lexical boundary and both halves will still be legal programs. -- ShaeErisson


CategoryProgrammingLanguage FunctionalProgrammingLanguage StackBasedLanguage


EditText of this page (last edited September 6, 2011) or FindPage with title or text search