Re: [stack] Joy's relationship to FP + a Joy variant with combining forms
John Nowak <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
On May 31, 2008, at 1:34 PM, John Cowan wrote: > This technique squeezed almost all the polymorphism out of actual > APL programs. Part of my interest in using combining forms is for exactly this reason. Certain combinators like 'each', which takes a list and a quotation and calls the quotation for each value of the list as it is pushed onto the stack, are difficult to handle efficiently. The reason is that the quotation can use any amount of the stack as any combinator with an effect of type 'A b -> A' can be passed in. This means the programmer can write things like like 'random-boolean [pop] [+] if each', where the actual arity of the quotation passed to 'each' is indeterminable up until the moment it gets there. Obviously more grotesque examples can be constructed. As such, combinators like 'each', while very useful, seem to require the implementation to use a stack. This issue evaporates if we know the function that is to be used with 'each' at compile time. - John