Re: [stack] Atoms

John Cowan — 2001-08-14 16:59:45

Jack Waugh wrote:

> What is [dup] first? Would the execution of "[dup] first"
> execute "dup", or would it leave some atom #dup on the top of the
> stack?


The latter. Indeed, that is the general way of pushing
the name of a function on the stack for using in constructing
programs.


> I was going to pose this question in terms of "infra", the combinator
> that applies a function to the stack represented by a list, and
> returns a list representing the result stack. For the purposes of
> representing stacks as lists for "infra", which end of the list
> corresponds to the top of the stack?


The left end.


Manfred, you should consider putting these into the FFAQ.


--
There is / one art || John Cowan <jcowan@...>
no more / no less || http://www.reutershealth.com
to do / all things || http://www.ccil.org/~cowan
with art- / lessness \\ -- Piet Hein

Manfred von Thun — 2001-08-15 05:16:22

On Tue, 14 Aug 2001, John Cowan wrote:

> Jack Waugh wrote:
>
> > What is [dup] first? Would the execution of "[dup] first"
> > execute "dup", or would it leave some atom #dup on the top of the
> > stack?
>
>
> The latter. Indeed, that is the general way of pushing
> the name of a function on the stack for using in constructing
> programs.

See the new "Further Frequently Asked Questions about Joy",
at the end of the FAQ.

> > I was going to pose this question in terms of "infra", the combinator
> > that applies a function to the stack represented by a list, and
> > returns a list representing the result stack. For the purposes of
> > representing stacks as lists for "infra", which end of the list
> > corresponds to the top of the stack?
>
> The left end.

I have added this to the online manual in interp.c

I have also fixed (at last !) the wrong description of "times"
in the online manual. The need for this was pointed out by some
kind person on the group ages ago, but it just slipped my mind.

And while I'm at it, I had to make a tiny change in scan.c
for function getsym. Explicit get for integers (and floats)
no longer works with the new number reading function from
the C-library. So when a new line is read into the line buffer
by getsym, I added a space ' ' before the \0 at the end of
the buffer. This happens for every line that is read by the
scanner, so perhaps it is not an elegant solution. Maybe you
(John Cowan) can think of a better way. If you are busy at
the moment, I think there is no need to update the joy.tar.gz
so soon. I am working on the libraries when I can, and when
that is done I would like an update.

- Manfred