User talk:PureFox

From Rosetta Code


Hello. I noticed you added Kotlin example for Emirp primes and couple other pages. In case you're interested, I pulled all Kotlin code into a repository on github Dmitry Kandalov 15/12/2016

comment about "Four is the number of letters in the ..."[edit]

Addressing the possible sentence length difference, are you keeping the commas in the never-ending sentence intact (after display the count and the word)?   -- Gerard Schildberger (talk) 15:34, 12 September 2017 (UTC)

By the way, I changed the   name   of the task   --- it had a typo that I missed (many times) of the first word.

The old name was:

  Fours is the number of letters in the ...

The new name is:

  Four is the number of letters in the ...

I also will be changing the requirement about showing the total number of characters of the sentence.
The change will be to show the sentence length after each display, and because you already did that, you won't have to change your Kotlin entry.

Thanks for entering your Kotlin entry.   -- Gerard Schildberger (talk) 15:34, 12 September 2017 (UTC)

Hi Gerard,

Yes, as far as I can see, the commas are being counted when computing the sentence length and this seems to be borne out by the sentence lengths being the same for N == 201.

I will re-run my version of the (REXX) program and post the complete never-ending sentence at the talk page of that Rosetta Code task.

No, I meant, are the commas   left   in the never-ending sentence, that is, are the commas still in the never-ending sentence.   I couldn't tell if the removal of the commas are from removing them from a word, or from the never-ending sentence.   -- Gerard Schildberger (talk)

I wondered whether there might be a difference in the spelling of the numbers (or ordinals) somewhere but I haven't been able to find one. So, for the moment at least, I'm baffled!

Yes, a difference in the spelling either the number (the length of a word),   or the ordinal number (of the location of the word) may be the cause of the difference.   I'll re-run a modified version of the (REXX) program and post the first 2,100 or so   2,202   words of the never-ending sentence at the talk page of that Rosetta Code task;   hopefully, we should be able to visually determine the difference(s).   -- Gerard Schildberger (talk) 19:21, 12 September 2017 (UTC)
Thanks Gerard. After studying your print-out I've realized what the problem was, namely a simple misunderstanding on my part. I was thinking previously that the 'sentence' was all words up to and including the 'N'th but, of course, it's all words up to and including the next comma if the 'N'th word doesn't end with a comma. In the case of the 201st and 2,202nd words it just so happened that those words did end with a copy and so our sentence lengths were in agreement.
Yuppers, I made sure that the number chosen actually pointed to a word (a spelled ordinal number) that ended in a comma, which would make it (I had hoped) easier to find the problem of the differences in the lengths of the never-ending sentence.   -- Gerard Schildberger (talk) 00:14, 13 September 2017 (UTC)
Anyway, it was easy to fix and our two entries are now in total agreement. --PureFox (talk) 00:05, 13 September 2017 (UTC)

Incidentally, I've altered the preamble to the Kotlin entry now that you've made sentence length part of the task for all values of N.

Yes, thanks to you, I didn't even realized that I used an incorrect phrasing of that requirement.   It was fortunate that you went ahead and adhered to what I had intended.   You must be a seer.   -- Gerard Schildberger (talk) 19:21, 12 September 2017 (UTC)

Thanks for the recent addition of this and some other interesting tasks. --PureFox (talk) 17:48, 12 September 2017 (UTC)

I've got quite a few more in the pipeline, now that I've recovered ... from not being at my best.   -- Gerard Schildberger (talk) 19:21, 12 September 2017 (UTC)

comment about "abbreviations, automatic[edit]

Thanks for finding that error in the table (file) that holds various language names for the days-of-the-week.

I have corrected the 89th line of that file that holds the (older style) Azerbaijani [Azeri] language (for the name of Saturday.

You don't have to re-run the Kotlin language entry if you don't want to.   Hopefully, that should be the last duplicate in that names file.
-- Gerard Schildberger (talk) 01:42, 19 September 2017 (UTC)

Thanks for correcting that line, Gerard. I thought I'd re-run the Kotlin program for the sake of good order and also remove the pre-amble which is no longer relevant. However, I haven't changed the code itself as it does no harm to allow for this possibility and prevents the program from entering an infinite loop.
I had thought of make that one of the task's requirements, but I thought it might be too complicated for this general task.   But looking back, it would've caught three errors in the file.   -- Gerard Schildberger (talk) 23:22, 19 September 2017 (UTC)
Incidentally, following the correction to the Cantonese line, I think your minimum length should now be 12 rather than 13. --PureFox (talk) 21:45, 19 September 2017 (UTC)
Yes, I'll update my correction.   -- Gerard Schildberger (talk) 23:22, 19 September 2017 (UTC)

Go solutions: panic, gofmt[edit]

I see you've added a number of missing Go solutions recently which is excellent.

I have however noticed you have tendency to use panic for error reporting which is a bad practice in Go and should be avoided in examples IMO. At a minimum I'd suggest using log.Fatal in future examples, and ideally that would only appear in the main function, other functions returning an error value as is idiomatic in Go. (Of course, idiomatic uses of panic, such as when detecting unrecoverable programming errors, are quite reasonable.)

Also, when I work on Go solutions here I tend to just copy-paste between my editor and Rosetta's edit web form which preserves the "standard" Go formatting of gofmt (actually goimports for me). I noticed your code uses four space indenting instead of gofmt's tabs==eight spaces which causes your Go solutions to look different from the majority of Go code on this site and elsewhere.

Just a little nitpicking :) —dchapes (talk | contribs) 18:57, 20 June 2018 (UTC)

Yes, you're right that I've been over-using 'panic' in my solutions and I'll try to avoid that in future.
Even though I have a number of issues with 'go fmt' (including the use of tabs rather than spaces), I have in fact been running it on my more recent solutions for the sake of uniformity. However, the one thing I cannot stomach is the use of 8 space tabs for indenting and, since there doesn't appear to be a way to change the tab length in the WikiMedia software, I've had to replace tab characters with (my preferred) 4 spaces before posting.
Although 'go fmt' uses tabs, I don't actually think there is any requirement that these be fixed at 8 spaces because Rob Pike himself stated about a year ago:
"The indent character is tab, whose width is your decision. That's in large part why the indent character is tab: to let you choose how much to indent."
So, if you don't mind, I'll be sticking to my 4 spaces when posting on this site whilst accepting the other strictures of 'go fmt'.
Incidentally, it's good to see that Go has at least 3 active contributors, which is two more than most other languages can boast. As a relative newcomer to the language, it helps me a lot to study other people's solutions.--PureFox (talk) 23:20, 20 June 2018 (UTC)

Mayan numerals[edit]

I like your rendering of Mayan numerals.   You know how to draw a cartouche.   Kudos.     -- Gerard Schildberger (talk) 22:57, 16 January 2019 (UTC)

Thanks Gerard. An interesting task for me as I knew zilch before about Mayan numerals.
I've seen the discussions on how best to display the cartouches but I'm relaxed about using the 'traditional' box drawing characters as, whatever one does, it will be sure not to display properly in some browser or platform.--PureFox (talk) 16:45, 20 January 2019 (UTC)

cuban primes[edit]

Could you update your cuban primes entry?     I had a typo in the requirements, it should be 200 cuban primes to be listed, not 100.     -- Gerard Schildberger (talk) 14:18, 1 February 2019 (UTC)

Sure, I've just attended to it.--PureFox (talk) 14:59, 1 February 2019 (UTC)
Thanks a lot.   Sorry that I missed that typo.   But the good news is that only one language entry (solution) needed to be changed.     -- Gerard Schildberger (talk) 15:03, 1 February 2019 (UTC)

Chemical Calculator[edit]

Haha, sorry for misleading you with my python solution! I still have issues with my Nim solution. It also lacks eval. Typed Nim should be quicker than Python, but my solution is worse. Maybe I will copy yours! --ChristerNilsson (talk) 14:44, 20 March 2019 (UTC)

No problem, Christer:) Your original Python solution (and my Go translation of it) were on the verbose side and I knew I'd run into problems with the lack of eval if I tried to use RE to simplify the parsing. So I thought I'd try and write something from scratch which turned out to be quite easy once I'd come up with a way to evaluate any parenthesized parts of the formula.--PureFox (talk) 15:20, 20 March 2019 (UTC)



I just saw that you translated my Rust code to Go in the Sandpile task. This is the first time anyone "used" my code like that, so this made me quite happy. Thank you! :) - Nemin (talk) 21:52, 24 August 2019 (UTC)

Hey, thanks to you for adding an interesting new task! It's not something I knew anything about previously but your Rust code was nice and clear so I thought I'd just do a straight translation. It's working well :) --PureFox (talk) 23:23, 24 August 2019 (UTC)

agreeing statistics[edit]

I quite relieved that our numbers (totals) match concerning the Rosetta Code task "Fraction reduction".   I was afraid that my code may have missed something and I'd have to re-examine the REXX code to see what is causing the difference.   I know the "five-digit" fractions took my program a wee bit of time to complete,   that is why I made it an optional part of the task.   I don't think I'll try to complete the "six-digit" fractions,   but I'm hoping that somebody will try.     -- Gerard Schildberger (talk) 17:27, 3 September 2019 (UTC)

Yes, I'm relieved as well as it's so easy to make a blunder with this kind of task! I have some ideas about quickening up the Go solution but it will need to be considerably faster to be worthwhile tackling the six-digit fractions. Thanks for posting another interesting task. --PureFox (talk) 18:04, 3 September 2019 (UTC)
I've rewritten it and it's now about 5 times faster than before but probably still not enough to bring the six-digit fractions within reasonable reach. Further improvements may be possible - I'll keep thinking about it. --PureFox (talk) 19:51, 3 September 2019 (UTC)
I've rewritten the REXX version twice, and each time it cut the run time in half.   I can modify the   hasDup   function further,   but it would make the program so not idiomatic, and difficult to read and/or understand.   The gain would be around (maybe) 2% speed reduction,   and it probably wouldn't be worth the ugliness of the code.     -- Gerard Schildberger (talk) 21:04, 3 September 2019 (UTC)
A 4 x speedup for your REXX entry is great. No such luck in my case and I think it's as quick as I can get it. However, I've just acquired a new machine which reduces the runtime for 5-digits to under 25 seconds and has enabled me to process the 6-digit case in about 15.5 minutes. Not as many 'positives' (9778) as I'd have expected so hopefully some-one else will be able to provide an independent check that the stats are correct.--PureFox (talk) 11:16, 6 September 2019 (UTC)

humorous epigraph[edit]

The last time I included an epigraph   (in a Rosetta Code task preamble)   it garnered some push-back.   This time, the epigraph is humorous and more befitting the Rosetta Code task   (complete with a smiley face).     -- Gerard Schildberger (talk) 21:12, 3 September 2019 (UTC)

I don't think you'll get any push-back this time. Made me smile anyway :) --PureFox (talk) 11:17, 6 September 2019 (UTC)
Yeah, I thought it was one of the most amusing little ditty, and of course, to the point of the Rosetta Code task.     -- Gerard Schildberger (talk) 20:09, 6 September 2019 (UTC)