Re: [stack] are concatenative languages applicative?
John Nowak <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
On Apr 24, 2008, at 10:35 PM, John Cowan wrote: > John Nowak scripsit: > >> - '1 2 3' is a *function* of type 'A -> A Num Num Num'; when >> evaluated, the *values* 1, 2, and 3 get pushed onto the stack > > I agree with that. > >> - '3' is a *function* of type 'A -> A Num', not a value of type 'Num' >> as in Haskell or ML; when evaluated, the *value* 3 gets pushed onto >> the stack [...] > > You are making a distinction between '3' and 3 that I believe to be > unwarranted. There is only 3, and it is both a numeric value and > a function to be applied to the stack. Maybe I'm not being precise enough. The type of the term '3' is 'A -> A Num', just like the type of '1 2 3' is 'A -> A Num Num Num'. >> In short, even '3' is a function in Joy. This should be obvious as we >> can assign a name to it: >> >> foo = 3 >> >> Here, we're not binding 'foo' to the value of 3; we're declaring that >> 'foo' is a function that pushes '3' onto the stack. > > We are doing both at once. No we're not; we don't evaluate the right-hand side to figure out what to bind 'foo' too. >> Never at any point are we manipulating values. > > The function +, among many others, can only be understood in terms > of values. Sure, but when we're manipulating programs, such as translating '1 [2 +] i' to '1 2 +', we're not manipulating any terms bound to values. - John