0 1:} y

is the u} form of }, executing u to get the indexes to be modified.

0 1:} y   will be the same as
0 (1)} y

Henry Rich

On 1/20/2014 10:32 AM, Ian Clark wrote:
Thanks, Brian, for answering Bo for me.

Bo's question made me scratch my head.
I did zeroco so long ago I've forgotten what I was thinking at the time.

    0 1} i.6
|rank error
|       0 1}i.6
    0 1:} i.6
0 0 2 3 4 5

So the example is genuine: it works. But why???
I tried covering 1: to see just what it gets called with...

    one=: 3 : 0
smoutput 'one' ; y
1
:
smoutput x ; 'one' ; y
1
)
    0 one} i.6
┌─┬───┬───────────┐
│0│one│0 1 2 3 4 5│
└─┴───┴───────────┘
0 0 2 3 4 5

...so (one) -- and therefore presumably 1: -- gets called dyadically with
the 0 and the i.6

But I have to admit I don't really know why it works :-)
Perhaps I will when I've had my afternoon nap.


On Mon, Jan 20, 2014 at 1:29 PM, Brian Schott <schott.br...@gmail.com>wrote:

Bo,

Amend is an adverb that can take either a noun or a verb as its immediate
argument. The reason the first example fails is that when 0 1 is used,
amend takes the 0 and the 1 as its argument, not just the intended 1,
because the parser does not know to separate out the two numbers. But when
1: is the supplied, because it is a verb and 0 is not, the correct result
is obtained.


On Mon, Jan 20, 2014 at 2:02 AM, Bo Jacoby <bojac...@yahoo.dk> wrote:


Thanks for the http://www.jsoftware.com/jwiki/Vocabulary/zeroco . I have
trouble in understanding the example

0 1} i.6      NB. Try to amend 1{i.6 to zero |rank error |       0 1}i.6
  0 1:} i.6 0 0 2 3 4 5
Is there a typo in the comment? ('{' versus '}')

I thought that 0 1:} is a fork, but is is not:


    (0 1: }) i.6
|syntax error
|   (    0 1:})i.6

Is it a hook?
    0 (1: }) i.6
0 0 2 3 4 5


So I'm pretty confused.
Thanks, Bo.


--
(B=)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to