Re: [stack] unary functions from X to Y?

Chris Double <[email protected]>
Newsgroups gmane.comp.lang.concatenative
Message-ID <[email protected]>
On Mon, Mar 9, 2009 at 5:58 AM, William Tanksley <[email protected]> wrote:
> Actually, a queue is a bad choice for the future structure. XY uses it
> because it wanted an easy to do 'dip', but 'dip' doesn't require a
> persistent structure. When used only to view and modify the future, XY
> treats its queue as a stack -- which is the correct approach.

XY doesn't need access to the end of the queue for dip either. It
could implement it using patterns:

; pdip { [a f] f / a } ;
1 2 4 [ + ] pdip
=> 3 4

Once you have dip is there any need for a retain stack or the ability
to modify the end of the queue?

> I think Forth's system is terrible, since it
> negates the benefits of easy factoring; but XY's system makes it hard to
> look as far into the future as Forth's system can. But what about
> partial continuations -- neither language provides those, although both
> come close.

XY provides partial continuations in the library. Since XY allows
complete control of the queue any sort of control structure becomes
possible. F is similar in that it provides an operator $. It expects a
quotation on the stack with stack effect ( stack queue -- stack queue
). It calls it with the current stack and queue, and replaces the
existing stack and queue with the result. The other queue/stack
manipulations are built on that. Too much flexibility?

Chris.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.