Hello R.E..;
Given that the comparison machinery of Less(-.) is not really needed, I
submit the following::
3(}.i.)7
3 4 5 6
Unfortunately it presents the same space usage problems:
1000003 (}.i.)1000007 NB. makes two BIG lists and discards most of
them.
R.E. Boss wrote:
Most elegant is
3 (-.~&i.) 7
3 4 5 6
Or if you want to include y
3 (-.~&i. >:) 7
3 4 5 6 7
R.E. Boss
-----Oorspronkelijk bericht-----
Van: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Namens Geoff Canyon
Verzonden: maandag 22 september 2008 9:19
Aan: Programming forum
Onderwerp: [Jprogramming] Integers from x to y
Some programming languages have built-in commands that give the
integers from x to y. I thought that would be a nice thing to have in
J, so I wrote this:
f =: [+i.@(0&>[EMAIL PROTECTED])~
Is that a reasonable way to go about it?
regards,
Geoff
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
--
------------------------------------------------------------------------
|\/| Randy A MacDonald | APL: If you can say it, it's done.. (ram)
|/\| ramacd <at> nbnet.nb.ca |
|\ | | The only real problem with APL is that
BSc(Math) UNBF'83 | it is "still ahead of its time."
Sapere Aude | - Morten Kromberg
Natural Born APL'er |
-----------------------------------------------------(INTP)----{ gnat }-
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm