Re: [stack] Fwd: [Factor-talk] cleave, 2cleave, and spread

"William Tanksley, Jr" <[email protected]>
Newsgroups gmane.comp.lang.concatenative
Message-ID <[email protected]>
John Nowak <[email protected]> wrote:
> Daniel Ehrenberg wrote:
>  > though, I think a dup/swap/dip/drop base would be easier to work with
>  > in a statically typed language.

I think that's going to have to depend on the meaning of "easy to work with".

>  Absolutely; they're simple, direct, and efficient to implement.

In other words, you're looking from the perspective of the compiler
writer (especially a type inferencing compiler).

From a programmer's perspective, the simplest base will depend on the
type of programming. This is why I so much liked the stack shuffle
notation instead of the classic named stack rearrangement words; they
replace a bunch of executable concepts with a single non-executing
pattern.

BUT... These words are also a replacement for a base, and they would
be useful for writing code where parallel dataflow is the central
concept.

> Of course, it's easy to imagine reducing this list. For example:
>     drop  :: A b -> A
>     blort :: A b c [A -> D] -> D c b b

You have read http://tunes.org/~iepos/joy.html, right? If I'm reading
you right, the big difference between your basis and his bases is that
yours is designed to be typed (whoops, and that it doesn't enlist). In
his terms, I think your combinator is:

[C] [B] [A] blort == A [B] [C] [C]

>  And from this we can derive the standard functions as such:
>     swap = [] blort drop
>     dup  = swap [] blort
>     nip  = swap drop
>     dip  = [] swap blort drop nip
>     i    = [] dip drop
>     ...

>  There is possibly a cleaner typed two function base than this; it's
>  just my first stab at it. I am not sure though there is a cleaner base
>  where only one of the two functions is a combinator.

I'm not sure what you'd define as "cleaner", but I suspect a smaller
number of inputs and outputs would qualify.

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