Hello to All, CORRECTION to my previous post:
I produced a horrible bug in the display of time/space measurements at the end of the script. With the bugfix, the time/space display, the use of ^: does not appear very fast any more. Please accept my apologies, JoHo ////////////////////////////////////////////////////////////////////////////////////////////// NB. ... using Function Power for the iteration ... J807 JoHo niter=: 4 (]([,<@])6&?@:>@:{.)^:niter[,<55 NB. deal 6 out of 55 in boxes +--+----------------+----------------+---------------+---------------+ |55|21 19 0 45 32 25|31 42 35 8 28 32|11 10 0 44 53 8|50 53 36 9 0 29| +--+----------------+----------------+---------------+---------------+ 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|4 7 48 31 9 29|23 5 28 26 0 15|31 32 6 43 40 8|15 14 28 17 34 13| +--+--------------+---------------+---------------+-----------------+ 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|15 10 43 31 41 14|44 4 23 34 52 10|32 36 34 14 44 39|17 8 44 35 22 7| +--+-----------------+----------------+-----------------+---------------+ NB.- evaluation - ts=: 6!:2, 7!:2@] NB. Phrases 14A ft=: 12j6 12&": rt=:{. ([ , (<.&.(1000&*))@:(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@: (] ,"1 rt)@: >@:(100&ts each) ,"1 0 ] ) R;M;a;b;c +----------+------+----------+------+--------------------------------------------+ |0.00150774|913920|0.00150774|913920|sink=: 6&?&.> niter $ 55| +----------+------+----------+------+--------------------------------------------+ |0.00171113|211264|113.489 |23.116|sink=: ;/ 6? niter # 55| +----------+------+----------+------+--------------------------------------------+ |0.0404131 |146560|2680.37 |16.036|sink=: (]([,<@])6&?@:>@:{.)^:niter[ boxit 55| +----------+------+----------+------+--------------------------------------------+ |0.0423511 |145920|2808.9 |15.966|sink=: (niter deal6power) boxit 55| +----------+------+----------+------+--------------------------------------------+ |0.0415871 |147200|2758.23 |16.106|sink=: (6&? dealpower niter) 55| +----------+------+----------+------+--------------------------------------------+ $sink 2001 NB. ////////////////////////////////////////////////////////////////// ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm