[stack] stackless concatenativity + visual dataflow

John Nowak <[email protected]>
Newsgroups gmane.comp.lang.concatenative
Message-ID <[email protected]>
Here is a visualization of the function 'swap dup dip swap' where we  
want the quotation supplied to 'dip' to consume two arguments and  
produce one (as '+' or 'cons' does); note that 'R' and 'S' are row  
variables that represent some "rest of the stack":

     http://johnnowak.com/heap/stackless-dataflow.png

As you can (maybe?) see, the restrictions necessary to allow a  
stackless implementation of a concatenative language, namely that the  
arities of all functions be locally knowable, simplifies things quite  
a bit. At the very least, it gives us a nice mapping to a visual  
dataflow language where each "transformer" has a fixed number of  
"ports" and the column position of each "port" directly corresponds to  
an absolute stack position (for lack of a better term). I find this  
easier to follow than the alternative version and would certainly find  
it easier to explain to someone else.

I suppose all there is to do at this point is implement an interpreter  
for such a language and see how painful the "fixed arity" restriction  
is relative to its benefits. I suspect a simple macro system would go  
a long way towards making the restriction tolerable by allowing  
"generalized" versions of combinators to be written. Alternatively,  
syntactic support for specifying arities could be built into the  
language. Ultimately, that would be really no different than the  
information you give the compiler when you write something like (foo a  
b c) in Scheme.

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