Re: [stack] the concatenative wikipedia article
John Nowak <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
On Jan 11, 2009, at 10:51 PM, William Tanksley, Jr wrote:
>> Perhaps this is a better example:
>
> I'm having a hard time grasping the rules, so I'm limited to asking
> questions. But if a pair of definitions are valid, is their
> juxtaposition also always valid?
Yep. It's just composition in the opposite order.
> I could also imagine a language where composition is indicated by
> an explicit operator, and simple juxtaposition indicated curried
> application.
Sounds like Haskell to me! The reason Haskell sucks for pointfree
programming though is that most of the functions are curried. As such,
you need to modify the functions to get data into the correct places
(e.g. 'flip f') rather than manipulating the data directly (e.g. 'f .
swap'). All existing and proposed concatenative languages opt for
handling multiple values via products (stacks, lists, etc) rather than
using curried functions. All other pointfree language (FP, FL) or
mostly pointfree languages (APL, J, etc) that I can think of do the
same.
>> Applicative languages do not need a tree structure. The combinatory
>> calculus is applicative and can even be written with a
>> "concatenative"
>> syntax. Look at Unlambda.
>
> Every applicative language has a tree structure; unlambda is no
> exception.
I think I may've taken tree structure too literally. I see your point.
> See the page that ieros/Kerby wrote on concatenative combinators. In
> order to make up for this advantage, concatenative combinators have to
> be more complex than applicative ones. In short, conc. combinators
> have to provide a "make siblings" operation, while applicative
> combinators don't need that because they have a sibling operation
> implicit in their syntax.
I'm not quite sure I understand. I'm going to guess (correct me if I'm
wrong) that you mean concatenative functions need to preserve the
values they don't act upon:
Applicative:
\x y -> x + y
"Concatenative":
\((s, x), y) -> (s, x + y)
If that's what you mean, I don't think you're correct. I won't
elaborate though as I probably misunderstood things. Please clarify if
you can.
- John