I thought of and tried this variant using under, <.&.(2&^.) , an hour or so ago, but found it twice as slow as #(</\&.#:) :

   ts'(<.&.(2&^.))q'[q =: ?100000#10000
0.0427351 4.19738e6

    ts' #(</\&.#:)q'
0.0235223 4.19789e6

Mike



On 03/02/2014 16:36, Raul Miller wrote:
Why would I want to avoid using #: ?

If it's for performance reasons, I might be tempted to take the
performance critical code and translate and compile it in some other
language, then use the cd mechanism to bring it in to work with the
rest of my code.

But here's another way of defining leftmostBit:

leftmostBit=: 2 ^ 2 <.@^. ]

     (2 ^ 2 <.@^. ]) 2222222222222222222222222222222222222222x
1361129467683753853853498429727072845824

(that's 2^130x)

Thanks,



---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to