my attempt at expressing them in J

greeting =: '+#007';'&+5,670$6';'*';'%.+*2'
o =: >./ q: ". > (, , [)&.>/ greeting
o =: o + +`*:`%:`<:"0 , $&> |. greeting
o (4 : '(+&x)&.(a.&i.)&.> y')"0 greeting

Am 24.12.20 um 14:05 schrieb emacstheviking:
> Henry,
> 
> What's the upper bound on that pre-allocated list, that's a good technique
> actually. But what do I know?
> My main issue was more the fact I couldn't see another way to do it but
> both Raul and Clifford have shown me the way.
> 
> Seasons greeting to all, I'd express that in J but...
> 
> On Thu, 24 Dec 2020 at 13: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
> 

-- 
----------------------
mail written using NEO
neo-layout.org
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to