And in ancient days it was done in APL as:

   y=: 3 5 2
   (i.+/y) - y#}:+/\0,y
0 1 2 0 1 2 3 4 0 1



----- Original Message -----
From: Roger Hui <[EMAIL PROTECTED]>
Date: Thursday, September 11, 2008 6:54
Subject: RE: [Jgeneral] Verb Sequences - u@:v and [EMAIL PROTECTED]
To: General forum <[email protected]>

> I get your point but to do it literally without @ you can do:
> 
> ;@:(i.&.>)
> 
> 
> 
> ----- Original Message -----
> From: Henry Rich <[EMAIL PROTECTED]>
> Date: Thursday, September 11, 2008 6:10
> Subject: RE: [Jgeneral] Verb Sequences - u@:v and [EMAIL PROTECTED]
> To: 'General forum' <[email protected]>
> 
> > Ric gave the example I thought of (change 'first item'
> > to 'last item' in the example).
> > 
> > Generally you need @ when your verb has to have
> > rank other than _ .
> > 
> > Try this: create a verb that produces a sequence of
> > index vectors for the atome of its input, by which I mean
> > 
> >    v 3 5 2
> > 0 1 2 0 1 2 3 4 0 1
> > 
> > Using @ you have
> > 
> >    v =: ; @: (<@i."0)
> > 
> > I can do it without @ but I don't think I'd want to.
> > 
> > Henry Rich
> > 
> > > -----Original Message-----
> > > From: [EMAIL PROTECTED] 
> > > [mailto:[EMAIL PROTECTED] On Behalf Of Alex Rufon
> > > Sent: Thursday, September 11, 2008 4:10 AM
> > > To: General forum
> > > Subject: [Jgeneral] Verb Sequences - u@:v and [EMAIL PROTECTED]
> > > 
> > > Hi.
> > > 
> > > I'm at Chapter 12 of J for C Programmers and Henry was 
> > explaining verb
> > > sequences.
> > > 
> > > You see, I have never ever used @: or @ in my years of use 
> of 
> > > J so this
> > > is a bit confusing for me.
> > > 
> > > Like in the example on page 111 where it defines:
> > >    ]a=: 1 2 3; 4 5; 6 7 8
> > > +-----+---+-----+
> > > |1 2 3|4 5|6 7 8|
> > > +-----+---+-----+
> > > 
> > > The requirement was remove the first box and just get the 
> > > first items of
> > > the succeeding boxes. The solution that was provided was:
> > >    }.@:({.@>) a
> > > 4 6
> > > 
> > > Since I've don't use "Verb Sequences", my solution was:
> > >    }. {. "1 > a
> > > 4 6
> > > 
> > > I tried doing the other samples and I can still come up with 
> > solutions> without using the @ and @: symbols.
> > > 
> > > So I am wondering if anybody has good examples where I would 
> > > absolutely
> > > need to use verb sequencing so I can compromise with myself 
> > when to
> > > properly use the symbols.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to