y=: a.{~ (a.i.'A')+i.4 5
   m=: 3 1 0 2 1
   m}y
PGCNJ
   n=: 0 2 1 1 3
   n}y
ALHIT

   (m,:n) 4 : 'x}y'"1 _ y
PGCNJ
ALHIT

That is the nature of operator (adverbial or conjunctival) arguments:
you can not slice and dice them with other operators.
Use of explicit definition overcomes this flaw.



----- Original Message -----
From: "R.E. Boss" <[email protected]>
Date: Sunday, April 11, 2010 8:44
Subject: [Jprogramming] Amend
To: 'Programming forum' <[email protected]>

> In the vocabulary 
> http://www.jsoftware.com/help/dictionary/d530n.htm the
> following example is given:
> 
>    y=: a.{~(a.i.'A')+i.4 5
>    m=: 3 1 0 2 1
>    y;m;m}y
> +-----+---------+-----+
> |ABCDE|3 1 0 2 1|PGCNJ|
> |FGHIJ|         
> |     |
> |KLMNO|         
> |     |
> |PQRST|         
> |     |
> +-----+---------+-----+
> 
> But what if n=: 0 2 1 1 3  and I want (n,:m) } y ?
> 
>    (n,:m)}y
> |rank error
> |       (n,:m)}y
> 
> I could do
> 
>    (n,:m) } ,:"1~y
> ALHIT
> PGCNJ
> 
> but that is neither elegant nor efficient.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to