Good one!

(I haven't tested, but I expect you could say <^:3"0 in place of <@<@<"0 )



> On Mar 27, 2014, at 4:26 PM, Thomas Costigliola <[email protected]> wrote:
> 
>   (*/@{/~<@<@<"0@i.@#)  4 3 2 8
> 48 64 96 24
> 
> 
> 
>> On Thu, Mar 27, 2014 at 4:10 PM, Dan Bron <[email protected]> wrote:
>> 
>> Oh, I like this game!
>> 
>>           (*/ % ]) 4 3 2 8
>>        48 64 96 24
>> 
>>           (*/@#~1-=@i.) 4 3 2 8
>>        48 64 96 24
>> 
>> -Dan
>> 
>> ----- Original Message ---------------
>> 
>> Subject: Re: [Jprogramming] J as an interviewing tool
>>   From: Roger Hui <[email protected]>
>>   Date: Thu, 27 Mar 2014 12:44:59 -0700
>>     To: Programming forum <[email protected]>
>> 
>> Suppose you did not have the outfix operator, but still have array ops.
>> 
>>   x=: 4 3 2 8
>>   I=: =i.#x
>>   I
>> 1 0 0 0
>> 0 1 0 0
>> 0 0 1 0
>> 0 0 0 1
>>   (-.I)*/ .(^~) x
>> 48 64 96 24
>> 
>> 
>> 
>> 
>> 
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to