Joy, Lambdas, Combinators, Procedures

iepos@tunes.org iepos@tunes.org
Thu, 27 Jan 2000 12:06:47 -0800 (PST)


> One thing about Joy which bothers me is that it gives no way
> > to formally express, for example, the number "2". Although it
> > is possible to express the _program_ that "pushes the number 2
> > onto the stack" (such a program is expressed simply as "2"), the
> > number 2 itself cannot be represented. 
> 
> Okay, I admit it -- I'm completely and utterly lost.  What are you talking
> about?  The symbol 2 represents the number 2.

Here's an excerpt from the Joy synopsis (under the section
"Joy compared with other functional languages):

   The program
  
      3  +

   denotes the composition of two functions from stacks to stacks. The
   first pushes the number 3, the second adds two number on top of the
   stack. The entire program denotes a function which adds 3 to the top
   number of the stack. The space between the 3 and the + is not
   application written in reverse but composition.

The authors of Joy want to interpret the symbol "3" as the program that
pushes the number three onto the stack; they do not interpret it
as the number three itself. Hopefully that clears things up.

Anyway, Joy is only intended to be a "programming language", so
I suppose it is intentional that programs are the only things
that can be expressed in it.

> >   put "hello" (wait 1 (put "world" stop))
> 
> > This seems to require a "stop" primitive.
> 
> 'stop' is a very bad name -- 'nil' might be better.

Oops, sorry for choosing a bad name ... 
Seriously, although the name doesn't really matter too much,
"nil" is usually used as a list terminator, so using "nil"
could be a bit confusing. In case it was not clear, by
"stop" I mean the procedure completion "Do nothing".
Telling the system to "stop" would have no effect.

> > [building "chaining" into procedures]
> > Anyhow, this is probably not
> > really a new idea.
> 
> What is different about it?  It seems the same as all the other functional
> languages.

Hmm... Well, Haskell for example doesn't seem to use this technique.
In Haskell, a procedure "putChar 'b'" is considered atomic
(rather than a function that takes the thing to do next); the
binary operator ">>" (hidden by syntax sugar often) is used
to chain procedures together. If there is a result, ">>>" is used,
I believe.

> > Anyway, enough rambling... As usual there is my recently updated
> > site on TUNES at
> >  http://www.tunes.org/~iepos
> > which I humbly proclaim as the Best source of introductory
> > information on combinators (that I know of).
> 
> Really!  I'll have to check it out.  It'll have to be really good to
> overpower both Joy and "The Forth shall be First".

I was not really being serious. 
I'd like to have your input on it though...
It is surely filled with typos and numerous other errors.

Anyway, Forth is beginning to sound interesting...
What is your favorite Forth system?

> > - "iepos" (Brent Kerby)
> 
> -Billy
>