Re: [stack] Re: Some thoughts on Object Cat
"Christopher Diggins" <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
On Thu, Apr 24, 2008 at 12:29 PM, John Cowan <[email protected]> wrote: > Christopher Diggins scripsit: > > These two approaches are not incompatible. There are two equally valid > > semantic views of a Joy program: compose all functions then apply the > > resulting function to the empty stack, or apply each of the functions > > to the stack in sequence. > > Indeed. It's the mark of a concatenative language that eval is compose > followed by apply, but that doesn't mean that eval *is* apply except in > the degenerate case where there is only one function to compose. I am talking about "i" in terms of what it does as a stack transformation function, where whitespace denotes composition (an important detail is that it denotes composition within brackets as well as outside), and "[...]" is an abstraction operation (i.e. a lambda, and not some kind of informal notion of "quotation"). You appear to be focusing on the particular implementation details in a Lisp style language. Here is what I understand that you have in mind for an evaluator in pseudo-code: S x = (apply x S) S [x0 x1 ... xN] = (cons (quote (x0 x1 ... xN)) S) S i = (eval (car x) (cdr s)) That is of course a valid implementation of Joy. However it obscures what is happening from a mathematical standpoint when Joy expressions are expressed as functions on stacks. This is why so far people keep switching between formal mathematical concepts like "application" and "composition" and then jumping into a completely different notions of "eval", "quote", "dequote" within the same paragraph. The following semantics more accurately represent what happens from a pure mathematical standpoint and demonstrate the meaning of "i" that I am trying to explain: S x = (apply x S) S [x0 x1 ... xN] = (cons (compose (x0 ... xN)) S) S i = (apply (car x) (cdr s)) Where: (define (compose x . xs) (if (null? xs) x (lambda (S) (apply (compose (car xs) (cdr xs)) (apply x S))))) Finally I will point out that the following are both valid interpretation of "S x y" S x y = (apply x (apply y S)) S x y = (apply (compose x y) S) My apologies, but this has to be my last post on the subject. This discussion has already consumed too much of my time, and I sense a strong unwillingness to understand what I am patiently trying to explain. - Christopher