In Sean's case I'd use: 100 3 ?@$ 2 100 100
if a verb is needed for x numbers with specs y I'd use: stargen=: (, #) ?@$ ] Don't worry about feeling stupid, I did so for a while too, and it goes away. Not because you know everything, but because you realise J is really deep, and there's so many nooks and crannies to discover (and rediscover, once forgotten again). Better start enjoying it, it's a long trip ;) and very rewarding. Aside of that, there's plenty of help to be gotten, both in documentation and the very knowledgable and friendly community (on this mailing list, but also on stackoverflow.com[0]). For a beginner, I would really recommend reading the books (e.g. Learning J[1], and JforC [2]), the labs (after installing the addon labs/labs, in the jqt menu help>studio>labs). Good luck with your J journey, and all the best for the festive season. Jan-Pieter [0]: https://stackoverflow.com/questions/tagged/j [1]: https://www.jsoftware.com/help/learning/contents.htm [2]: https://www.jsoftware.com/help/jforc/contents.htm On Thu, Dec 24, 2020, 14:01 Henry Rich <[email protected]> wrote: > i. 100 returns a section of a pre-allocated list, so it doesn't even > have to generate anything. > > (? 100 $ y) is a smidgen slower than (100 ?@$ y) > > Henry Rich > > On 12/24/2020 7:37 AM, Raul Miller wrote: > > Generating that list of numbers is trivial, compared to typical > > language processing. > > > > Consider a classic "for" loop, which calls a function 100 times. Here, > > you are also generating 100 numbers. It's true that they are not > > stored in memory simultaneously, but you're also generating 100 stack > > frames, one after another -- and the cost of constructing those is > > significant. Writing to one memory location is less work than > > populating a typical stack frame. > > > > Also, in terms of actual memory consumed -- unless you're up in the > > megabytes, you aren't going to even notice it on modern machines. > > > > That said, if your concern is the *relevance* of the numbers, I'd go > > with something like: > > > > 1,.~? 100 $ ,: 2 1024 768 > > > > Which, looking at what Cliff Reiter suggested, is basically the same > concept. > > > > Good luck, > > > > > -- > This email has been checked for viruses by AVG. > https://www.avg.com > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
