I suspect /\. beats /\ because \ does not have special code taking advantage of m&|@* being commutative.
-- Raul On Tue, May 16, 2017 at 12:51 PM, 'Mike Day' via Programming <[email protected]> wrote: > Yep - a blocky approach addresses the virtues of a vector approach and > > minimises the hit with extended. Could fine tune it but why bother!? > > I quite often end up using blocks in this sort of fashion, though overlooked > > it here. > > Note to self, though - must look into why /\. with reverse is better! > > Thanks again, Raul, > > Mike > > > On 16/05/2017 17:04, Raul Miller wrote: >> >> Oops, need x: instead of <. >> >> |. 281474976710656&|@*/\.x:1+2*i.-2^24 >> >> Sorry about that, was using <. earlier to test whether that fixed the >> overflow issue (it does not), and grabbed that instance for this >> variant. >> >> This is bulkier, though, just like your */\ version: >> >> timespacex'|. 281474976710656&|@*/\.x:1+2*i.-2^12' >> 0.005394 2.72333e6 >> datatype |. 281474976710656&|@*/\.x:1+2*i.-2^12 >> extended >> >> And if I could think of an efficient way of demoting the result type >> to integer, I think I could use that reduce some of the bulk. >> >> Sadly, though, the obvious approach doesn't do it: >> >> timespacex'|. 281474976710656&|@*/\.&.x:1+2*i.-2^12' >> 0.004687 2.65882e6 >> >> Still... why not break this into pieces? >> >> Something like (warning, untested code): >> >> genseries=:3 :0 >> r=. '' >> n=.1 >> for. i.2^6 do. >> r=. r,|. 281474976710656&|@*/\.&.x:n+2*i.-2^18 >> n=. {:r >> end. >> r >> ) >> >> Thanks, >> > > > --- > This email has been checked for viruses by Avast antivirus software. > https://www.avast.com/antivirus > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
