boxdraw_j_ 1
[A=:Q;X;Y
+-----+-----+--------+
|0 1 0|0 1 2|10 11 12|
|1 0 1|3 4 5|13 14 15|
|0 1 0|6 7 8|16 17 18|
+-----+-----+--------+
first =: 0&({::)
second=: 1&({::)
third =: 2&({::)
f =: first`(second,:third)} NB. tacit amend
f A
0 11 2
13 4 15
6 17 8
f Q;(3 3$'abcdefghij');(3 3$'ABCDEFGHIJKLMNOP')
aBc
DeF
gHi
NB. This is not restricted to binary choice:
(0&{::)`(>@:}.)} 0 1 1 2 2 ; '1st' ; '2nd' ; 'THIRD'
1ndRD
(0&{::)`(>@:}.)} Q ; X ; Y
0 11 2
13 4 15
6 17 8
>Date: Mon, 07 Jul 2014 20:46:32 +0200
>From: Erling Hellen?s <[email protected]>
>To: [email protected]
>Subject: Re: [Jprogramming] Tacit J and indexed replacement
>Message-ID: <[email protected]>
>Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
>An example:
>
>x=:3 3 $i.9
>y=:x+10
>q=:2|x
...
>q {"0 1 x,"0 y
>0 11 2
>13 4 15
>6 17 8
>/Erling
>
>On 2014-07-07 19:53, Erling Hellen?s wrote:
>> It's obviously not possible to do any amendments in tacit code? It is
>> also less elegant to pass these three parameters in the two arguments
>> in tacit code?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm