Actually, you could use scan with lazy evaluation: nest one level down and
evalute the next iterative functor there.

All the same if you treat the problem as a sequence of data structures to be
activated and resolved.

In any case the basic idea is already in flight ...

On 5/22/07, Dan Bron <[EMAIL PROTECTED]> wrote:

Terrence,

You might consider that you can move your index up by more than one at
every iteration.

When you're done with  2&pp  you already know that 4 is not a prime
candidate.  So, at the end of  3&pp  you could advance to  5&pp  .  That
is,  you could shorten:

           5 pp 4 pp 3 pp 2 pp A

to:

           5 pp      3 pp 2 pp A

But, of course, you cannot know this in advance; you have to update your
index at the end of every  pp  .  So you couldn't use scan.

But you could, for example, recurse:

           rec  =:  {. , 1 , { (] (i.&1@:] $:^:(<#) *) 0 ~: |) (}.~ >:)~
           soe  =:  2 rec 0: 1} i.
           SoE  =:  I.@:soe

           SoE 20
        2 3 5 7 11 13 17 19


-Dan

PS to Roger:  There's another bug in   f.  wrt  $:  :

           dyd =. [ $: ]
           bob =. 'x' dyd ]
           bob f.
        'x' 4 : 'x [ $: ] y' ]

The fixed form of  bob  should have parenthesis around the verb within the
explicit definition, like so:

        'x' 4 : 'x([ $: ])y' ]

The problem is the original  dyd  is defined with a train of verbs, but
its fixed counterpart is not.

(bug report entitled:  TRAIN DERAILED  or  FIXED VERBS BROKEN :)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm




--
--
Roy A. Crabtree
UNC '76 gaa.lifer#
(For TN contact, email me to set up a confirmed date/time)

[When you hear/read/see/feel what a yehudi plays/writes/sculpts/holds]
[(n)either violinist {Menuhin} (n)or writer {"The Yehudi Principle"} (n)or
molder (n)or older]
[you must strive/think/look/sense all of it, or you will miss the meanings
of it all]

[EMAIL PROTECTED] Forwards only to:
[EMAIL PROTECTED] CC: auto to:
[EMAIL PROTECTED] Be short < 160 chars cuts off; currently
offline
[EMAIL PROTECTED] CC: auto to ^

http://www.authorsden.com/royacrabtree
http://skyscraper.fortunecity.com/activex/720/resume/full.doc
--
(c) RAC/IP, ARE,PRO,PAST
(Copyright) Roy Andrew Crabtree/In Perpetuity
   All Rights/Reserved Explicitly
   Public Reuse Only
   Profits Always Safe Traded
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to