Now, using the old trick of passing chunks of data to a verb if possible,
even using the recursive version a 512x512 picture can be produced under
a second on my Surface Pro...
Josephus=. (0:`(] | [ + [ $: (_1 + ])))@.(1 < ])
viewmat @: ([ load @:('viewmat'"_)) @: |: @: ((Josephus % <:@])"_ 0/~)
@: >: @: i. 512
On Thu, May 2, 2013 at 9:42 PM, Linda Alvord <[email protected]>wrote:
> Here's a little shorter version for viewmat.
>
> Josephus2 =: 4 :'(|x&+)/i.->:y'
> 4 Josephus2 38
> viewmat ([[: load 'viewmat'"_) ((Josephus2 % [:<:])"0/~) >: i.32
>
> Linda
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Jose Mario
> Quintana
> Sent: Thursday, May 02, 2013 9:16 AM
> To: Programming forum
> Subject: Re: [Jprogramming] rosettacode
>
> Try to replace 1024 by a shorter number, say, 100. That will show you a low
> resolution section of the larger picture ; however to appreciate the
> texture
> you need to look at a large picture.
>
> In addition, Elton's iterarative version: ( Josephus2 =: 4 :
> '(|x&+)/i.->:y' ) runs faster.
>
>
> On Thu, May 2, 2013 at 2:45 AM, Linda Alvord <[email protected]
> >wrote:
>
> > I seem to be missing something. If I run this script "7.ijs" , your
> > version of Josephus works fine.
> >
> > Josephus=. (0:`(] | [ + [ $: (_1 + ])))@.(1 < ])
> > 3 Josephus 41
> > 4 Josephus 38
> > NB.viewmat @: ([ load @:('viewmat'"_))@:((Josephus %<:@])"0/~) @: >:@:
> > i.1024
> >
> > However, if I remove NB. and run "7.ijs" again, it says Ran... but
> > when I go to jijx it is running for more than 5 minutes and I lose
> > patience. Then the only option seems to be to close "jhs.bat -
> > shortcut" and begin again.
> >
> > Raul says it finishes quickly....
> >
> > Linda
> >
> >
> > -----Original Message-----
> > From: [email protected]
> > [mailto:[email protected]] On Behalf Of Jose
> > Mario Quintana
> > Sent: Wednesday, May 01, 2013 11:57 PM
> > To: Programming forum
> > Subject: Re: [Jprogramming] rosettacode
> >
> > Now I am puzzled too; somehow 1024 became 12! Thanks again for your
> > help and your patience :) So, the offending line should have been:
> >
> > viewmat @: ([ load @:('viewmat'"_)) @: ((Josephus % <:@])"0/~) @: >: @:
> i.
> > 1024
> >
> > I hope this time all is right.
> >
> > On May 1, 2013 7:30 PM, "Raul Miller" <[email protected]> wrote:
> > >
> > > I'm puzzled now, by your comments about patience. This calculation
> > > finishes quickly, for me.
> > >
> > > Did you mean that patience is needed in studying the resulting image?
> > >
> > > --
> > > Raul
> > >
> > > On Wed, May 1, 2013 at 7:23 PM, Jose Mario Quintana
> > > <[email protected]> wrote:
> > > > Thanks, I forgot ( y=. @] )
> > > >
> > > >
> > > > On Wed, May 1, 2013 at 6:54 PM, Raul Miller
> > > > <[email protected]>
> > wrote:
> > > >
> > > >> On Wed, May 1, 2013 at 6:24 PM, Jose Mario Quintana
> > > >> <[email protected]> wrote:
> > > >> > viewmat @: ([ load @:('viewmat'"_)) @: ((Josephus % <:y)"0/~)
> @:
> > >:
> > > >> @: i. 12
> > > >>
> > > >> What is y in this example?
> > > >>
> > > >> Thanks,
> > > >>
> > > >> --
> > > >> 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
> > > --------------------------------------------------------------------
> > > -- For information about J forums see
> > > http://www.jsoftware.com/forums.htm
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm