User talk:SqrtNegInf

From Rosetta Code

Talking to myself... --SqrtNegInf (talk) 18:34, 12 April 2018 (UTC)


Hey, when you get a chance, could you give the latest version of RC-run (April 24) a try? It is especially useful with the -d & -b flags set IMO. If you have any observations or suggestions, I'd be interested. --Thundergnat (talk) 00:49, 25 April 2018 (UTC)

I tried to exercise all relevant combinations of command-line options, and everything is working as advertised. The one problem I found was when I ran multiple tasks from a file, after 'Bitmap_B_zier_curves_Cubic', all subsequent tasks ended up rooted below the first, e.g. 'rc/perl6/Bitmap_B_zier_curves_Cubic/rc/perl6/Card_shuffles/'; for some reason the 'chdir $current' didn't work. One suggestion: If the value of '$view' could be set via the command-line, users on other platforms could more easily view graphical results. --SqrtNegInf (talk) 12:58, 25 April 2018 (UTC)
Update: The two items mentioned above were related... When the 'view' command failed in the 'run-it' sub, it exited early, 'chdir' didn't happen. When I set $view as something innocuous, /usr/bin/file, then things were fine. --SqrtNegInf (talk) 18:54, 25 April 2018 (UTC)
Doh! Thinko. Line 169 should be .resume instead of return.--Thundergnat (talk) 19:11, 25 April 2018 (UTC)

Hofstadter-Conway $10,000 sequence / Perl 6

Removed the 'fast' (and less elegant) alternative version as it no longer has any performance advantage with the current release of Rakudo. At the time of the initial 6.c release (2015.12) there was a nearly 5-fold difference in run times.


I wanted to say thanks for all the new the Perl and Perl 6 task implementations you've been writing. Love it! Danaj (talk) 17:40, 30 October 2018 (UTC)

File IO

Thanks for finding and fixing the Perl 6 file IO errors, my time is pretty limited for the near future. I have to say though, I feel a little less clueless about making that error / assumption when I see who added the entry for Last_letter_first_letter. --Thundergnat (talk) 14:44, 20 November 2018 (UTC)

Thanks for the advice

>> When you add/edit a task, put a short summary of what you've done

I will manage future edits accordingly.--Hkdtam (talk) 10:14, 3 December 2018 (UTC)

Thanks for fixing my missing tag

Arrg. Didn't notice the missing closing div tag in Count Examples. It looked fine in preview, I got called away just as I submitted and didn't double check. Thanks. --Thundergnat (talk) 02:19, 22 January 2019 (UTC)

Thanks - RE: Problems with 'Addition chains' task

>> Can you double-check that the 'Addition chains' task

Oh thank you very much for pointing it out. I don't why that two less than/greater than equal signs got change to bare equals during copy and paste. Anyway thanks again. --Hkdtam (talk) 16:37, 4 February 2019 (UTC)

Range consolidation

Doh. Good catch on the Range consolidation task. I cut out a bunch of logic dealing with excluded boundaries and completely missed the the enclosed range case. To be fair, there weren't any test cases that exercised that or I probably would have noticed. Thanks. --Thundergnat (talk) 23:30, 5 February 2019 (UTC)

Actually, there is: [-6, -1], [-4, -5], otherwise I doubt I would have found the problem. I don't know if Paddy3118 was clever or lucky in using that pairing. Your output as shown was correct, so I figured an earlier version worked, but the urge to stream-line the code caught up with you...
Argh. Hoisted on my own petard. Indeed, you are correct. Glad there is a second set of eyes looking at this stuff. --Thundergnat (talk) 00:38, 6 February 2019 (UTC)
Luck 😊 --Paddy3118 (talk) 14:21, 6 February 2019 (UTC)

Chemical Calculator

  • Whow 1: I've never seen a so clever way of using regexp and a grammar. Must be a combination of a very good language and a very good programmer.
  • Whow 2: Of course, the atomic table only needs six entries. You were the first one to realize that.

I could use many words to state why minimalism is superior. But, I wont.

I'm so glad I started to use RC. --ChristerNilsson (talk) 13:54, 20 March 2019 (UTC)

I had a leg up on most since this task intersects with my $day_job (I modified that code from something I've been using for years). But I do agree that Perl regex are pretty handy. Check out the addition to the task I just made, even more regex... --SqrtNegInf (talk) 11:55, 21 March 2019 (UTC)

RE: Perl 6 treatment of '\r\n'

Thanks for the answer. --Hkdtam (talk) 03:22, 25 March 2019 (UTC)


Hey, if you have a chance, could you look over my alternate entry for Eban_numbers#Algorithmically_generate_.2F_count and fix any egregious errors / unidiomatic code? It's been (mumble) years since I've done any serious Perl 5 programming and I've got Perl 6 idioms so ingrained it was a challenge to go back.

The modules may have better choices too. I used L::E::Nums2Words instead of L::E::Numbers because it covers more orders of magnitude. I probably could have used plain old List::Util. It works but I'm sure it could be improved. ta! --Thundergnat (talk) 15:38, 28 March 2019 (UTC)

I was thinking of doing this very thing, since my approach scales poorly, but you beat me to it. It looks perfectly fine to me (the most important thing is that you used the One True brace placement style). Contemplated removing my version, but hey it's all about learning. --SqrtNegInf (talk) 20:03, 28 March 2019 (UTC)
In K & R we place our trust. So mote it be, amen. ;P --Thundergnat (talk) 22:49, 28 March 2019 (UTC)

Amusingly alliterative annotations as adding alternate answers

As above. :-) --Thundergnat (talk) 09:54, 17 May 2019 (UTC)

RE: Circular primes

Thanks for catching the bug. I took for granted the reasoning was right and didn't check/compare the output, sorry. --Hkdtam (talk) 18:05, 7 April 2020 (UTC)

About the dividing rectangle task

Oh I am sorry that I was not able to prove on my previous attempt for all Primes in the sequences that Pᵢ/rTotal ≠ Pⱼ/bTotal will always be true so perhaps on some rare situations two opposing triangles can be congruent. If you don't mind please let me clean up my own mess on the Perl entry then. Sorry again for any inconvenience caused. --Hkdtam (talk) 17:07, 26 January 2022 (UTC)

Hi again, just for your information I updated the entry, please review it when you are free, thanks. Also since there is a ratio check now so I remove the usage of prime in order to reduce one module dependency. Anyway thanks again. --Hkdtam (talk) 18:06, 28 January 2022 (UTC)
Yes, would be nice if Perl had primes function built-in, but don't it happening anytime soon. Kudos to you for keeping after it and perfecting the code. My only real contribution was the too-clever-by-half display code. --SqrtNegInf (talk) 23:10, 28 January 2022 (UTC)

Zumkeller twiddles

The reasoning behind the separate test statements, and [&&] rather than [and] is that the way I had it, the tests are high precedence and short-circuiting; as soon as one fails it stops testing and moves on to the next maybe. With the low precedence conditionals, it will test every branch whether or not one has already failed. It will reach the same conclusion in the long run but waste a lot more processing cycles getting there. Does it matter in the long run? Meh, probably not, but I purposely structured it that way for a real reason. C-style loops are still (marginally) faster than range iteration. Sub sum() is still (marginally) faster than method .sum (or at least it was last time I checked, which admittedly has been some time.) For the first two parts it probably doesn't make a discernible difference. I was optimizing to try to make the third part not so tedious. (Same reason I used ntheory rather than built-ins.) The other stylistic twiddles? Yeah, that was me being lazy. Cheers. --Thundergnat (talk) 10:36, 30 May 2022 (UTC)

I confess that initially I did only the most cursory of speed tests before committing the new version (hmmm, that seems fine, click). I do have a tendency to care more about how the code reads than how it runs, but what you say is true so I took it as an excuse (barely needed) to go down the rabbit hole and do more complete testing on Zumkeller, plus further tests on other kinds of operations. To a degree that surprised me, the take-away was that generally the details of how a given line or block of code is written–in the context of a larger program–barely matter, the timing differences ending up within the error bars. There are counter-examples where it does matter, and since Raku is not the speediest of languages to begin with we all need to be mindful of that (he said, looking in the mirror).
Overall, I take this as great news. It means that when writing Raku programmers can indulge their particular coding peculiarities / OCD (or whatever DSM-IV code applies in ones' individual case) and mostly turns out fine, now and probably in the future as well, which is when most of the code is going to be seen and/or run (100-year language and all that). But if I went too far: tack back! --SqrtNegInf (talk) 18:15, 9 June 2022 (UTC)