The Artima Developer Community
Sponsored Link

Heron-Centric: Ruminations of a Language Designer
The Joy of Joy
by Christopher Diggins
February 4, 2006
Summary
I have recently discovered the somewhat unknown and understated language, Joy. A pure functional language, without lambda operations!

Advertisement

The Joy programming language is an intriguing beast in the programming language menagerie. It is an exceedingly powerful little language. Joy is based on the idea of "function-level programming" outlined by Backus which is distinct from "functional programming". Here is a short synopsis from the language designer, a philosophy professor named Manfred von Thun:

Whereas all other [note: should be 'most other'] functional programming languages are based on the application of functions to arguments, Joy is based on the composition of functions. All such functions take a stack as argument and produce a stack as value.
Here is a simple Joy program for performing a quick sort, taken from the Wikipedia article about Joy:
DEFINE qsort ==
   [small]
   []
   [uncons [>] split]
   [[swap] dip cons concat]
   binrec .
That is very elegant, even if somewhat cryptic on first glance. Here is the explanation from Wikipedia
"binrec" is one of Joy's many recursive combinators, implementing binary recursion. It expects four quoted programs on top of the stack which represent the termination condition (if a list is "small" (1 or 0 elements) it is already sorted), what to do if the termination condition is met (in this case nothing), what to do by default (split the list into two halves by comparing each element with the pivot), and finally what to do at the end (insert the pivot between the two sorted halves).
The Joy language bears some obvious similarities to Forth. Forth has decent recognition as an efficient language. I wonder how efficient a Joy interpreter and/or compiler could be? How small? I am building one right now, just for the fun of it. For those that remember my little foray into a functional programming dialect in C++, called Unimperative, I am resucitating it as a Joy dialect.

At this point, I am still exploring the possibilities of using some dialect of Joy for different purposes. Here are some ideas:

I wonder why more people don't talk about Joy. Perhaps it just isn't cool ... yet.

Talk Back!

Have an opinion? Readers have already posted 11 comments about this weblog entry. Why not add yours?

RSS Feed

If you'd like to be notified whenever Christopher Diggins adds a new entry to his weblog, subscribe to his RSS feed.

About the Blogger

Christopher Diggins is a software developer and freelance writer. Christopher loves programming, but is eternally frustrated by the shortcomings of modern programming languages. As would any reasonable person in his shoes, he decided to quit his day job to write his own ( www.heron-language.com ). Christopher is the co-author of the C++ Cookbook from O'Reilly. Christopher can be reached through his home page at www.cdiggins.com.

This weblog entry is Copyright © 2006 Christopher Diggins. All rights reserved.

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2014 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us