Hello to All, NB. ... using Function Power for the iteration ... J807 JoHo
niter=: 4 (]([,<@])6&?@:>@:{.)^:niter[,<55 NB. deal 6 out of 55 in boxes +--+-----------------+-----------------+-----------------+-----------------+ |55|19 46 33 41 43 15|53 18 16 15 20 54|41 15 24 23 36 32|19 30 20 22 51 45| +--+-----------------+-----------------+-----------------+-----------------+ NB. more readable ... deal6=: 6&? linkr=: [ , <@] NB. similar to ; ... but boxes the the right side only NB. Explict> applytofirst =: 1 : ' u@:>@:{. ' APPLYTOFIRST=: @:(>@{.) fnpower=: ^: deal6power=: ((] linkr (deal6 APPLYTOFIRST))fnpower) boxit=:< (niter deal6power) boxit 55 +--+---------------+----------------+----------------+-----------------+ |55|18 40 29 32 8 3|50 9 35 51 49 10|10 12 52 6 54 51|27 14 42 25 32 33| +--+---------------+----------------+----------------+-----------------+ NB. - - more general using explicit definitions for adverbs and conjuntions NB. NOK tacit: dealpower=: ( (] linkr ( (&?) applytofirst))fnpower ) @: boxit powercosmetics=: 1 : '( ] linkr (u APPLYTOFIRST))' NB. u is monadic dealpower =: 2 : '((u powercosmetics)fnpower n)@:boxit y' NB. u is moniadic (6&? dealpower niter) 55 +--+----------------+----------------+--------------+-----------------+ |55|52 53 16 17 1 44|41 5 10 54 38 32|50 19 6 1 9 11|24 48 14 36 23 35| +--+----------------+----------------+--------------+-----------------+ NB.- evaluation - ts=: 6!:2, 7!:2@] NB. Phrases 14A ft=: 12j6 12&": rt=: {. ([ , <.@(100&*)@:([ %"1 ])) }. niter=:2000 sink=:niter#<1 2 3 a=:'sink=: (]([,<@])6&?@:>@:{.)^:niter[ boxit 55' b=:'sink=: (niter deal6power) boxit 55' c=:'sink=: (6&? dealpower niter) 55' R=:'sink=: 6&?&.> niter $ 55' M=:'sink=: ;/ 6? niter # 55' NB. Intel Pentium(M) 2.31GHz (Single Core) ( <"0@: rt@: >@:(100&ts each) ,"1 0 ] ) a;b;c;R;M +--------+------+--------------------------------------------+ |0.038323|146560|sink=: (]([,<@])6&?@:>@:{.)^:niter[ boxit 55| +--------+------+--------------------------------------------+ |95 |100 |sink=: (niter deal6power) boxit 55| +--------+------+--------------------------------------------+ |97 |99 |sink=: (6&? dealpower niter) 55| +--------+------+--------------------------------------------+ |2741 |16 |sink=: 6&?&.> niter $ 55| +--------+------+--------------------------------------------+ |2412 |69 |sink=: ;/ 6? niter # 55| +--------+------+--------------------------------------------+ So long, JoHo PS: I just cant get accustomed to the removal of u. v. / x. y. in explicit definition. On 13.03.2020 05:48, Skip Cave wrote:
How can I generate the following result extended 50 times, without explicit looping? (6?55);(6?55);(6?55);(6?55);(6?55) ┌───────────────┬───────────────┬─────────────────┬─────────────────┬───────────────┐ │13 4 19 43 3 52│10 1 4 46 52 11│38 12 48 50 54 45│36 54 39 35 53 50│44 1 7 54 11 41│ └───────────────┴───────────────┴─────────────────┴─────────────────┴───────────────┘ Skip Cave Cave Consulting LLC ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm