Re: [stack] Advantages of cat, joy ..?
John Nowak <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
On Mar 23, 2009, at 2:03 PM, William Tanksley wrote: >> surprisingly tricky. My banana combinator is one suggestion, but it >> requires each function return a single value which isn't always good. > > Correct; it's a kind-of-smart combinator. I prefer the term "kind-of-stupid combinator". > This is the big thing I don't > like about stack-copying behavior... Aside from the fact that > implementing it without an immutable stack is _hard_, it also assumes > the output for every operation is a single value at the top of the > stack. This may be a source of some confusion for us. If your programming language is typed (or requires that all functions have inferable stack effects), you don't need to use a stack in the implementation *at all*. Accordingly, you certainly never need to copy it. There's no efficiency penalty or implementation difficulty for something like the banana combinator in this situation. You're right that the single value output is unacceptable in the context of a stack-based language in many cases. > I especially like the variant of your language (is it still called > 'fifth'?) which uses juxtaposition to denote composition. I'm calling this current "concatenative FP" thing "Forthus". It has the concatenative elements of Forth and the ideas of John Backus. Back. Forth. Backus. Forthus. You get it. - John