On 5/21/07, Terrence Brannon <[EMAIL PROTECTED]> wrote:
Raul Miller <rauldmiller <at> gmail.com> writes:
>    next_prime=: I. <at> [ (I.{[) ]

When I type this into the J interpreter, it boxes it into 3 things
 [EMAIL PROTECTED]
 (I.{[)
 ]

so am I to understand that this is a dyadic fork with verbs u, v, w such that

x (u v w) y   <->  (x u y) v (x w y)

I am completely lost on how to understand this.

A=: 0 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
U=: [EMAIL PROTECTED]
V=: I. { [
W=: ]

  A U 3 4 5 6
2 3 5 7 9 11 13 15 17 19 21 23 25

U is the primes defined by A

W should be obvious -- it's your argument.

So the outer train essentially transforms A from a bit vector to
a sorted list of integers.  To cut down on the size of my lines,
I'm going to represent this transformed A as 2 3 5 7 9

  2 3 5 7 9 V 3 4 5 6
3 5 5 7

This is equivalent to
  2 3 5 7 9 (I. { [) 3 4 5 6

Again, we can break this down into individual verbs
  2 3 5 7 9 I. 3 4 5 6
1 2 2 3
I. looks things up in sorted lists

  2 3 5 7 9 [ 3 4 5 6
2 3 5 7 9
obvious

So, basically, we are looking up the right argument in
the (modified form of the) left argument, then using those
indices to select elements from the (modified form of the)
left argument.

Does this make sense?

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

Reply via email to