[Jprogramming] Selfdescribing Sequence
Roger Hui
RHui000 at shaw.ca
Tue Jan 10 07:24:42 HKT 2006
There can be substantial savings in space (and a slight
saving in time) if you use x +/@:< y instead of +/x<y .
The former exploits special code.
ts=: 6!:2 , 7!:2@]
ts '+/ golo < 1e9'
0.0933345 2.09843e6
ts 'golo +/@:< 1e9'
0.0818995 1408
----- Original Message -----
From: "Miller, Raul D" <rdmiller at usatoday.com>
To: "Programming forum" <programming at jsoftware.com>
Sent: Monday, January 09, 2006 2:55 PM
Subject: RE: [Jprogramming] Selfdescribing Sequence
Jose Mario Quintana wrote:
> But, of course, by definition the compact form of the series
> is the series itself. There you go!
I suppose I buried my treatment of this issue in too
much chatter, and left out part of the punchline.
self=: # >:@i.@#
unpack=: +/\^:_1
golo=: self&.unpack(^:7) 1 3
sg=:3 :'>: +/ golo < y.'"0
sg 1e9
438744
More information about the Programming
mailing list