Thanks Raul,

Even though a better way emerged, you got me to a solution without  @ or &
but it was a struggle!


   ]A=:'/9@Z`z'
/9@Z`z
   a.#~2|a.i.&0@/:@,"{A
0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
   k=: 13 :'a.#~2|(a.([:/:,)"0 1 y) (i."1) 0'
   k A
0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
   k
a. #~ 2 | 0 i."1~ a. ([: /: ,)"0 1 ]
   
Linda


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Raul Miller
Sent: Friday, March 08, 2013 9:21 AM
To: [email protected]
Subject: Re: [Jprogramming] List all alphanumeric characters

On Fri, Mar 8, 2013 at 2:41 AM, Linda Alvord <[email protected]>
wrote:
> What does this do?
>
>  ([: i.&0 /:)

The left verb here is the empty verb, so we need the monadic definitions of
the middle verb.

In i.&0 we have a verb and a noun, so & means that we are binding that noun
to that verb.  So it's i. with a right argument of 0.

So, the middle verb here finds the [first] index of 0 in its argument.

The right verb is grade up, which finds us the indices that we can use to
select the values of a list in sorted order.

   /: 'ABC'
0 1 2
   /: 'CDB'
2 0 1

So the index of a zero in its result is the index of the first element of
the original list in the result.

In other words I think this should always have a result of 1:
   ({. A) -: ([: i.&0 /:) A=: ?~ 100

Note however that ({. A) -: ([: i.&0 /:) A might be false (zero) if (/:~ -:
i.@#) A is false.

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