[Jprogramming] Just for fun, verb cross

Aai agroeneveld400 at gmail.com
Mon Dec 10 18:53:23 UTC 2012


Thanks for destroying my day.

Here's a much longer alternative

    ' ' (,{~[:((+.|.)@= ({"0 1) 0&,.) 1+i.@#@]) 'baabb'
b   b
  a a
   a
  b b
b   b

    _ (,{~ [: ((+.|.)@=({"0 1) 0&,.) 1+i.@#@]) 1 2 1 2
1 _ _ 1
_ 2 2 _
_ 1 1 _
2 _ _ 2




On 10-12-12 19:21, Roger Hui wrote:
> The expression fails if the argument has duplicate items. e.g.
>
>     ((+.|.)@={"0 1 ' '&,.)'aabbb'
> |length error
> |       ((+.|.)@={"0 1' '&,.)'aabbb'
>
>
>
> On Mon, Dec 10, 2012 at 10:18 AM, bob therriault <bobtherriault at mac.com>wrote:
>
>> That is lovely Arie,
>>
>> It is that kind of elegance that I was chasing with my rougher attempts.
>>
>> Using the (+.|.) hook simplifies (|.+.]) precisely and the {" 0 1
>>   combined with ' '&,. means that the selection of the string becomes a
>> choice in each row of displaying either the corresponding element of the
>> string or a blank.
>>
>> Cheers, bob
>>
>> On 2012-12-10, at 1:11 AM, Aai wrote:
>>
>>>   ((+.|.)@={"0 1 ' '&,.)'abcde'
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm

-- 
Met vriendelijke groet,
@@i = Arie Groeneveld



More information about the Programming mailing list