Joy Language

Joy is a purely functional programming language devised by Manfred Von Thun. 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 Concatenative Language.

See www.latrobe.edu.au (Official site), but also mirrored (mostly) at www.kevinalbrecht.com


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.


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 > .


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


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

Why?

If it's easy to do program proving, it is easy to write bug free programs.

If it's supremely simple to programatically manipulate, then many powerful tools to lint, debug, inspect, instrument, refactor it will evolve.


Joy Language is kind of a cross between Forth Language and Lisp Language. 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 Joy Language.

Joy Language also provides support for many of the different combinators (see Ess And Kay Combinators); it could be viewed as a usable big brother to Un Lambda Language.

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 Brain Death that comes straight out of Pascal Language.

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

A somewhat more mature implementation of the principles in Joy Language can be found in Factor Language (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. -- Shae Erisson


See original on c2.com