Re: [Jprogramming] Multiple Takes

2019-10-23 Thread R.E. Boss
Nothing personal intended. R.E. Boss > -Oorspronkelijk bericht- > Van: Programming > Namens Raul Miller > Verzonden: woensdag 23 oktober 2019 18:52 > Aan: Programming forum > Onderwerp: Re: [Jprogramming] Multiple Takes > > Sure... if you change the problem

Re: [Jprogramming] Multiple Takes

2019-10-23 Thread Raul Miller
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 &

Re: [Jprogramming] Multiple Takes

2019-10-23 Thread R.E. Boss
t;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 > Namens Raul Miller > Verzon

Re: [Jprogramming] Multiple Takes

2019-10-21 Thread Raul Miller
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 (A

Re: [Jprogramming] Multiple Takes

2019-10-21 Thread Roger Hui
~. 10&#.@~.&> , { 4#<0 1 2 6 ~. ". ~."1 > , {4#<'0126' On Mon, Oct 21, 2019 at 11:46 AM Skip Cave 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 'e

Re: [Jprogramming] Multiple Takes

2019-10-21 Thread Skip Cave
Wow! I hadn't really realized the power of catalogue '{'. This was a great learning experience. Thanks to everyone for the posts. I like keeping these things in the numerical domain: 10#.>,{4#{0 1 2 6 0 1 2 6 10 11 12 16 20 21 22 26 60 61 62 66 100 101 102 106 110 111 112 116 120 121 122 126 160

Re: [Jprogramming] Multiple Takes

2019-10-21 Thread 'Jim Russell' via Programming
Very nice! I'm glad I took the time to try to understand this one. > On Oct 21, 2019, at 11:16 AM, Raul Miller wrote: > > ".>,{4#<'0126' -- For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] Multiple Takes

2019-10-21 Thread Raul Miller
I think maybe that first one should have been ".>,{4#<'0126' 0 1 2 6 10 11 12 16 20 21 22 26 60 61 62 66 100 101 102 106 110 111 112 116 120 121 122 126 160 161 162 166 200 201 202 206 210 211 212 216 220 221 222 226 260 261 262 266 600 601 602 606 610 611 612 616 620 621 622 626 660 661 662 66

Re: [Jprogramming] Multiple Takes

2019-10-21 Thread Louis de Forcrand
Another (possibly lighter on memory) approach: ~. ; (#:i.2^4) <@(10 #. i.@!@# A. ])@# 0 1 2 6 Cheers, Louis > On 21 Oct 2019, at 01:09, Skip Cave wrote: > > Is there a less-verbose way to list all the integers (one-digit, two-digit, > three-digit, four-digit) can be formed by using the charac

Re: [Jprogramming] Multiple Takes

2019-10-21 Thread Clifford Reiter
Using Cartesian with duplicate digits ,".@:~.&>{4#<'0126' 0 1 2 6 1 1 12 16 2 21 2 26 6 61 62 6 1 1 12 16 1 1 12 16 12 12 12 126 16 16 162 16 2 21 2 26 21 21 21 216 2 21 2 26 26 261 26 26 6 61 62 6 61 61 612 61 62 621 62 62 6 61 62 6 10 10 102 106 10 10 102 106 102 102 102 1026 106 106 1062 106

Re: [Jprogramming] Multiple Takes

2019-10-20 Thread Skip Cave
B. Wilson, I like your last approach: , 10#.,"1/^:3~ ,. 0 1 2 6 0 1 2 6 10 11 12 16 20 21 22 26 60 61 62 66 100 101 102 106 110 111 112 116 120 121 122 126 160 161 162 166 200 201 202 206 210 211 212 216 220 221 222 226 260 261 262 266 600 601 602 606 610 611 612 616 620 621 622 626 660 661 662

Re: [Jprogramming] Multiple Takes

2019-10-20 Thread 'B. Wilson' via Programming
Over lunch, I just realized that my second implementation using integer digits could be expressed a lot more directly: , 10#. ,"1/^:3~ ,. 0 1 2 6 0 1 2 6 10 11 12 16 20 21 22 26 60 61 62 66 100 101 102 106 110 111 ... Which nicely mirrors the implementation using strings. On Mon, O

Re: [Jprogramming] Multiple Takes

2019-10-20 Thread 'B. Wilson' via Programming
I was a bit eager on the send button with that last message. Here is the previous approach, removing some superfluous stuff: , ". ,"1/^:3~ ,. '0126' 0 1 2 6 10 11 12 16 20 21 22 26 60 61 62 66 100 101 102 106 110 111 ... And here is essentially the same approach, but treating digit

Re: [Jprogramming] Multiple Takes

2019-10-20 Thread 'B. Wilson' via Programming
What about something like this? , ". (,/@:,"1/)^:3~ ,.'0126' 0 1 2 6 10 11 12 16 20 21 22 26 60 61 62 66 100 101 102 106 110 111 ... If S is the set of our digits, then the above essentially is just the Cartesian product S^4. On Sun, Oct 20, 2019 at 06:08:48PM -0500, Skip Cave wrote

[Jprogramming] Multiple Takes

2019-10-20 Thread Skip Cave
Is there a less-verbose way to list all the integers (one-digit, two-digit, three-digit, four-digit) can be formed by using the characters 0, 1, 2, and 6 once? I used multiple takes: *#b=.~.>10#.ea({1{."1 a),({2{."1 a),({3{."1 a),{a=.(perm 4){0 1 2 6* *49* *b* *0 1 2 6 10 12 16 20 21 26 60 61 6