Re: [Jprogramming] Calling a function N times

2020-12-24 Thread David Lambert
stargen@:(10 20"_)^:(<8)'' NB. perhaps you need ^: ? 0 0 0 0 1 6 5 1 1 4 11 1 0 7 4 1 0 1 9 1 1 7 6 1 0 7 13 1 0 6 19 1 |Date: Thu, 24 Dec 2020 10:47:47 + |From: emacstheviking |To: programm...@jsoftware.com |Subject: [Jprogramming] Calling a function N

Re: [Jprogramming] Calling a function N times

2020-12-24 Thread emacstheviking
Hi Joey, Hear hear! Long live the command line. Once browser UI madness has peaked we'll be running IBM3270 sessions in them again. On Thu, 24 Dec 2020 at 22:27, Joey K Tuttle wrote: > Inspired greetings - thanks Hauke and Raul. > > My own angle (not code) on it is that I read the emails on my

Re: [Jprogramming] Calling a function N times

2020-12-24 Thread Joey K Tuttle
Inspired greetings - thanks Hauke and Raul. My own angle (not code) on it is that I read the emails on my iPhone (a little tedious) and tried copy/paste of the lines into iOS j - but it didn't work because of the IDE... So, logging into my Pi4, using Terminus (a terminal emulator Roger D Mo

Re: [Jprogramming] Calling a function N times

2020-12-24 Thread Raul Miller
Hmm... email often wraps at around 72 characters, and I did not feel up to the task of squeezing this into a single line not exceeding that limit. However, maybe a two line approximation might still be acceptable? n=:#z=:(^~<:4){.a.{~({.i.@-)/0 1*&p:5 12 cutopen(n|-/\.)&.(z&i.)'sxjqzdl abmgoutkkgv

Re: [Jprogramming] Calling a function N times

2020-12-24 Thread emacstheviking
Thank you Jan! I am 55 now, I still feel as dumb as ever but at least the journey has been, and continues to be interesting and meeting like minds along the way! All the best you you in this madness too. On Thu, 24 Dec 2020 at 15:24, Jan-Pieter Jacobs wrote: > In Sean's case I'd use: > > 100

Re: [Jprogramming] Calling a function N times

2020-12-24 Thread Jan-Pieter Jacobs
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

Re: [Jprogramming] Calling a function N times

2020-12-24 Thread emacstheviking
Oh God, I knew it would happen.. Nice one Hauke! :D On Thu, 24 Dec 2020 at 14:41, Hauke Rehr wrote: > 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.

Re: [Jprogramming] Calling a function N times

2020-12-24 Thread Hauke Rehr
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-alloc

Re: [Jprogramming] Calling a function N times

2020-12-24 Thread Henry Rich
The value currently is about 400, but that may change without notice. Henry Rich On 12/24/2020 8:05 AM, emacstheviking wrote: 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 w

Re: [Jprogramming] Calling a function N times

2020-12-24 Thread 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 D

Re: [Jprogramming] Calling a function N times

2020-12-24 Thread Henry Rich
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

Re: [Jprogramming] Calling a function N times

2020-12-24 Thread Raul Miller
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,

Re: [Jprogramming] Calling a function N times

2020-12-24 Thread emacstheviking
Clifford, I don't like the boxing either, I also don't like the fact that generation of a list of numbers that I don't even use (i. 100) just to call a function N times was the only solution I could find. I almost don't ask questions around here as it makes me feel even more stupid than I normally

Re: [Jprogramming] Calling a function N times

2020-12-24 Thread Clifford Reiter
You might look at avoiding the boxing; for example ?10 # ,:3 1024 768 1 259 473 1 628 503 0 672 357 2 1003 559 0 407 117 2 620 116 0 840 45 2 581 444 2 166 629 1 217 202 On Thu, Dec 24, 2020 at 5:48 AM emacstheviking wrote: > I have a simple verb that returns a list of randomised

[Jprogramming] Calling a function N times

2020-12-24 Thread emacstheviking
I have a simple verb that returns a list of randomised numbers stargen=: monad define 'maxx maxy'=.y (?2),(?maxx),(?maxy), 1 ) For the life of me I have failed to just call it and create a table of the results. Initially I tried 100 $ stargen 1024;768 but that just calls it once and cycle repeat