The solutions with { are rather inefficient as one can imagine, which can be 
seen by scaling

   ts' ~.".~.@>,{10#<''0123456789'''
|limit error: ts
|   ~.".~.@>,    {10#<'0123456789'

De Forcrand's solution was better (at least it had one)

   ts'~. ; (#:i.2^10) <@(10 #. i.@!@# A. ])@# i.10
5.1813604 1.1912583e9

My solution scored in the same order

   ts'foo i.10'
5.713089 1.1684645e9

   (foo i.10) =&#  ~. ; (#:i.2^10) <@(10 #. i.@!@# A. ])@# i.10
1

With 

foo=: 3 : 0
 t=:<,.y
 r=. ([,-.~)"0 1~"1 y 
 for_k. >:i.2-~#y do.
  t=: t,<(k+1){."1 r=.,/(k&{.(,"1 ([,-.~)"0 1~) k&}.)"1 r
 end.
 t=: t,< y(],-.)"1>{:t
 ~.;10#.L:0 t
)

R.E Boss


> -----Oorspronkelijk bericht-----
> Van: Programming <[email protected]>
> Namens Raul Miller
> Verzonden: maandag 21 oktober 2019 22:22
> Aan: Programming forum <[email protected]>
> Onderwerp: Re: [Jprogramming] Multiple Takes
> 
> You can shave a character or so off that last one (using @ instead of "1):
> 
>    ~.".~.@>,{4#<'0126'
> 0 1 2 6 12 16 21 26 61 62 126 162 216 261 612 621 10 102 106 1026 1062
> 120 160 1206 1260 1602 1620 20 201 206 2016 2061 210 2106 2160 260
> 2601 2610 60 601 602 6012 6021 610 6102 6120 620 6201 6210
> 
> (And, yes, I hadn't read the thread to notice the omitted requirement.)
> 
> (Also, thinking about this thread: the A. approach winds up being far more
> verbose because implied leading zeros don't matter (could repeat), and
> numeric approaches tend to need 10#. instead of ". among other things
> which make them verbose.)
> 
> Thanks,
> 
> --
> Raul
> 
> On Mon, Oct 21, 2019 at 3:11 PM Roger Hui <[email protected]>
> wrote:
> >
> > ~. 10&#.@~.&> , { 4#<0 1 2 6
> > ~. ". ~."1 > , {4#<'0126'
> >
> >
> >
> > On Mon, Oct 21, 2019 at 11:46 AM Skip Cave <[email protected]>
> wrote:
> >
> > > Wow! I hadn't really realized the power of catalogue '{'. This was a
> > > great learning experience. Thanks to everyone for the posts.
> > >
> > > ...
> > >
> > > Is there any way to get rid of the extra 'eaches' in the function?
> > > Or is that the route I must take to use integers instead of characters?
> > >
> > ----------------------------------------------------------------------
> > 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

Reply via email to