Re: [stack] are concatenative languages applicative?

John Cowan <[email protected]>
Newsgroups gmane.comp.lang.concatenative
Message-ID <[email protected]>
John Nowak scripsit:

> We need to be more careful. Joy programs are expressed entirely in  
> terms of functions. Joy is a function-level language. I'll give three  
> examples to make this clear:
> 
> - '[1 2 3]' is a *function* of type 'A -> A [B -> B Num Num Num]';  
> when evaluated, it pushes the *value* [1 2 3] of type '[A -> A Num Num  
> Num]' onto the stack

I deny this.  I say that the type of [1 2 3] as a value is [Int Int Int],
and as a function its type is A -> A [Int Int Int].

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

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

> Never at any point are we manipulating values.

The function +, among many others, can only be understood in terms
of values.

-- 
Barry gules and argent of seven and six,        John Cowan
on a canton azure fifty molets of the second.   [email protected]
        --blazoning the U.S. flag               http://www.ccil.org/~cowan
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.