stackless concatenative?

Jianying Ji — 2006-09-02 06:29:36

The examples of concatenative languages such as joy, forth,
postscript, and factor, are all based on stack machines. Are there
concatenative languages that is non-stack based? based on say list,
queue or some more general data structure?

John Carter — 2006-09-04 00:04:30

On Sat, 2 Sep 2006, Jianying Ji wrote:

> The examples of concatenative languages such as joy, forth,
> postscript, and factor, are all based on stack machines. Are there
> concatenative languages that is non-stack based? based on say list,
> queue or some more general data structure?

Well, there is a quiet little implementation flourish within the bowels
of Joy that leaves me hesitant to describe it as a pure stack machine as
a CPU/hardware designer would define such things.

ie. Semantically it behaves like a stack, but one for which copying the
stack is cheap.

From an old message to the group from Manfred....

===========================================================
> But given the description...
> map : A [P] -> B
> Executes P on each member of aggregate A, collects results in
> same type aggregate B.
> ...I don't see how it works.
>
> Does map dup the whole stack before each and every execution of P?

Not a dup really, but it save a single pointer to the "old" stack
(easy and cheap if the stack is a linked list), and uses that
pointer to restore the old stack for each and every execution of P
(also easy and cheap). (Much harder if the stack is an array - but a
complete copy should never be necessary.)
=============================================================


John Carter Phone : (64)(3) 358 6639
Tait Electronics Fax : (64)(3) 359 4632
PO Box 1645 Christchurch Email : john.carter@...
New Zealand

"We have more to fear from
The Bungling of the Incompetent
Than from the Machinations of the Wicked." (source unknown)