Re: [stack] improved parallel combinator

"William Tanksley, Jr" <[email protected]>
Newsgroups gmane.comp.lang.concatenative
Message-ID <[email protected]>
John Nowak <[email protected]> wrote:
> I actually really like this one. No more weird pseudo-vector stuff.
> Here are the semantics:
>            S (| F |)  ==  S F
>        S (| F , G |)  ==  S F { S G } peek
>    S (| F , G , H |)  ==  S F { S G } peek { S H } peek

Very nice; I like it too, more than spread and its associated
functions. I presume that it's easier to typecheck?

To be complete, it would make sense to define a (- -) pair that serves
the place of "cleave". The definition's probably pretty obvious, but
I'll let you work it out because you're the typechecking expert...

But it also occurs to me that a general-purpose word is possible: let
me call it "multistack". The idea is that both (- -) and (| |) split
data and control flow into multiple stacks, run arbitrary code on
those stacks, and then combine the results onto the main stack; the
difference between the two is how they gather the data, and how they
combine it into the main stack.

It therefore seems that the multistack combinator would take three
arguments: one gatherer quotation, one combiner quotation, and one
sequence of quotations to be run on the split stack. If there are /n/
quotations in the sequence, the gather quotation will be run /n/
times, each time being passed an empty list; it must load that list
with data from the main stack. Each of those lists will be used as the
infra stack for the quotation within the sequence, and the resulting
stack will be placed into a list. Finally, the combiner quotation will
be run on each result list in the order its producing program appears
in the sequence.

This seems both general and statically determinable.

Is it?

It also seems too complex for regular use; really, we'd want to define
simple variants. I *think* it would be easy to define both of your
syntaxes using this combinator.

> - John

-Wm
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.