Re: [stack] function/object ambiguity + quotation alternative

Stevan Apter <[email protected]>
Newsgroups gmane.comp.lang.concatenative
Message-ID <[email protected]>
----- Original Message ----- 
From: "John Nowak" <[email protected]>
To: <[email protected]>
Sent: Thursday, February 26, 2009 12:45 PM
Subject: Re: [stack] function/object ambiguity + quotation alternative


> 
> On Feb 26, 2009, at 12:22 PM, Stevan Apter wrote:
> 
>>>   2. [dup] == [dup] first      (removing shared 'i' suffix)
>>
>> no.  dup = [dup] first.
> 
> You're missing the point. I know that 'dup = [dup] first', but I can  
> prove '[dup] == [dup] first'!
> 
> I'll start with your example (minus the swap); after each step, I'll  
> indicate how I came upon the given equality:
> 
> 1. 2 [dup] first i == 2 2        (given)
> 2. [F] i == F                    (given)
> 3  2 dup == 2 2                  (given)
> 4. 2 [dup] i == 2 2              (2+3: substituted '[dup] i' for 'dup')
> 5. 2 [dup] i == 2 [dup] first i  (1+4: both equal '2 2')
> 6. i == first i                  (5: removed shared '2 [dup]' prefix)
> 7. id == first                   (6: removed 'i' suffix)
> 
> To repeat, I know this is a bogus conclusion; that's my point. The  
> problem arises from the fact that '[dup] i' functions identically to  
> '[dup] first i' in XY; or, at least that's my understanding.
> 
> If my little derivation is wrong, please correct me. If not, I believe  
> this to be a problem in XY's semantics.

i see the problem.  in XY, [X]first != [X]i.

i moves the top of the stack to the head of the queue, whence it executes,
immediately.

first replaces the top of the stack with the first element of the top of
the stack.  

to make things just a little more confusing, there is no stack underflow
in XY, so e.g.

    [dup] first i = [{ a \ a \ a }]

and:
  
    10 20 [dup] [i] infra = 10 20 [[{ a \ a \ a }]]

which is the unit list of dup's "object code".  repeatedly applying i
to this has no effect.

but:

    [dup] first i 10 swap i = 10 10

but this is an implementation detail.  an underflow exception could be 
thrown instead.

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