- 1 hello
- 2 comment about "Four is the number of letters in the ..."
- 3 comment about "abbreviations, automatic
- 4 Go solutions: panic, gofmt
- 5 Mayan numerals
- 6 cuban primes
- 7 Chemical Calculator
- 8 Thanks!
- 9 agreeing statistics
- 10 humorous epigraph
- 11 a tank qew
- 12 your (Go) comment about the unprimeable task's goals
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 https://github.com/dkandalov/rosettacode-kotlin Dmitry Kandalov 15/12/2016
comment about "Four is the number of letters in the ..."
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.
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 so2,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
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.
- 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.
- 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)
Go solutions: panic, gofmt
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.
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
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.
- 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)
- 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)
- Sure, I've just attended to it.--PureFox (talk) 14:59, 1 February 2019 (UTC)
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)
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)
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)
a tank qew
Again, many thanks for your civility and helpfulness. A teeny-tiny wee bit of information sure went a long way in clearing this kerfuffle up. I'm embarrassed how many times I looked at the gosh-darned (pardon my language) output and I didn't see what you saw. It didn't help the situation that the output (result) was correct (as far as the result), but not the input (field). -- Gerard Schildberger (talk) 19:21, 29 November 2019 (UTC)
The phenomenon of peoples' minds interpreting the same thing differently (seeing what it wants to see) is called pareidolia.
- Haven't come across that word before which looks to be of Greek origin. I'll have to try and build it into my Go examples - make a change from emojis :) --PureFox (talk) 10:40, 30 November 2019 (UTC)
your (Go) comment about the unprimeable task's goals
I had thought of making some optional requirements (for extra credit or whatever), but I thought what I eventually come up with was challenging (tough) enough. I based this on how long me and my REXX program had to struggle with the (somewhat fast) testing for primeness, and other concerns. (How I wish REXX had a BIF for testing for primeness: an isPrime function). That would've made the job of creating a new and respectively moderate Rosetta Code task a lot easier, and also judging how easy (programming wise) a task should be (say, for most computer programming languages, if not all). I won't embarrass myself on how long I labored on this task; one problem was in the wording of the (or should I say, a) definition. I used a version that didn't mention that the number had to be composite, and I stumbled into also generating weaker primes (not to be confused with weak primes). This didn't show up until I stress tested the REXX program in searching for higher unprimeable numbers, and I just could not figure out where the problem was. This lead to a loss of even more hair (that I can't afford to lose by pulling it out). Thank gawd that I had a source that I could reference which had more unprimeable numbers listed and I deduced where the error lay. -- Gerard Schildberger (talk) 19:50, 1 December 2019 (UTC)
By the way, when I can't see through the fog of some Rosetta Code task's requirements (or algorithms), my first go-to is PL/I, which normally is not present, but has the closest syntax to REXX. My first major computer programming language was FORTRAN (back when it was all caps), my second language was PL/I. I can hardly recognize Fortran code anymore. My third language was GPSS (used for simulation of such things as bank teller queues, highway traffic, planes landing/taking off, etc. I practically melted my brain in trying to program various scenarios. All ya do is describe the queue and how people (or things) react, and "it" magically tells ya what ya want (or need) to know. ... Any-a-ways ... My second go-to on RC is Go (a proper and fitting name for a programming language in this case), it usually is the (for me) the clearest to understand. -- Gerard Schildberger (talk) 19:50, 1 December 2019 (UTC)
I think I should take a respite from working on Rosetta Code (et al), it seems a way bit too toxic at this point, and I have other hobbies to tend to. (Never argue with someone who buys ink by the barrel). I have an extensive library of over 2,500 railroad books (and some steam books), and it's index (descriptions, contents, bibliography, description of the book, ...) needs a bit of loving attention before it hopefully finds a new home in some RR museum. I might as well as labor on something that I enjoy and gives me bliss. Lately, it's been like pushing a chain up hill with Rosetta Code (cosmetic updates for readability, esthetics, and clarity). There's way too much ego to contend and hassle with. My other labor of love is a fancy-dancy, slicer-dicer, all-in-one (interactive, command-line) calculator that has over 1,500 functions in it, and also includes plotting (X, X/Y scatter plots, vertical and horizontal histograms, also supports plotting to all types of terminals/consoles/printers), multiple-argument functions (very much like APL), and many forms of columnar displaying of the output. Just the documentation (which is quite abbreviated) is over twenty thousand lines. I've been borrowing stuff from it for almost all of my various Rosetta Code tasks (that're appropriate for this site). Only a couple of thousand to go (just teasing). -- Gerard Schildberger (talk) 19:50, 1 December 2019 (UTC)
Also, by the way, thanks for finding an oversight of mine concerning the unprimeable task (25 vs. 35). Another case of not seeing the obvious. It was at one time, 25, and I changed it to 35, but the change was done on my other computer, and it never crossed over (walked over by using a USB stick) to my "work" computer. My other computer is an air-gap computer, a virgin (by internet standards). -- Gerard Schildberger (talk) 19:50, 1 December 2019 (UTC)
- I'm pleased in a way that you didn't add a stretch goal as these tend to turn into an 'arms race' between the faster languages (and Pascal always wins!).
- As you say, tasks involving prime numbers can be a problem when you don't have an isPrime function built-in. Go is in the same boat as REXX here as we don't have anything specifically for numbers up to 64 bits. We do have the ProbablyPrime() method for big integers which is said to be 100% accurate for numbers up to 2^64 (via the Bailee-PSW test) but big integers are unpleasant to use which is why I normally opt for simpler algorithms when the numbers involved are not too large.
- My first languages were Algol 60 and Fortran (I've never used PL/I) but I can't remember much about either now. After years of programming in the .NET and JVM languages, the relative simplicity of Go is refreshing (it more or less forces you to write clear, easily maintainable code) and it's good to know that you find it one of the clearer languages to understand yourself :)
- There is rather a lot of nit-picking on RC which probably puts people off from adding new tasks. Nevertheless I hope you'll continue to find the time (aside from your other hobbies) to add some more yourself as I always find them interesting and in some cases (the 'rare numbers' one for example) very challenging.
- I know you don't always see eye to eye with Thundergnat but I think you'll probably agree that (together with Paddy3118) he does a good job of administering the site, stamping hard on spammers and, of course, adding some interesting tasks himself. --PureFox (talk) 23:17, 1 December 2019 (UTC)
- I'd wish he spend more time on removing vanity tags. He was good along pretty good one day or so at those removals, but he stopped short after removing (mainly) one user who was really polluting one particular computer programming language. Once vanity tags start showing up, it's hard (if not impossible) to make changes to the code (example) without either making a change that the original author disagrees with, or adding your own vanity tag (I changed this), which compounds the problem. I'd remove them myself, but that can start an ugly and/or dirty edit war real fast, with a lot of name calling and such stuff. --- Oh yeah? Well, your mama codes in COBOL! Spammers are (to me), not that much of a problem, but like rats, if you don't get rid of them early, they soon multiply and everybody has to deal with the rat poop. -- Gerard Schildberger (talk) 23:56, 1 December 2019 (UTC)
- I have some really interesting thoughts about what Rosetta Code tasks that could be entered. I was "saving" them for later, as it involves something that someone entered on the newsgroup "alt.math.recreational" --- or --- "alt.comp", I forget which. It was in the same vein as Rosetta Code, present a problem and have people find algorithms to find a solution. You WOULD NOT believe the crap that one particular fellow had to endure (the site is not moderated), more or less what Rosetta Code has (as far as behavior goes). The last go-round I had at Rosetta Code, one particular fellow was really making a pain of himself. He has been permanently banned, but he has returned under several different names, changing his aliases every few months. And that fellow was doing some pretty bad (destructive) things before he was warned several times before the banning. Sure, there are RC administrators, but most newsgroups monitor their sites, mainly to stop the spam for illegal drugs, magic crystals, answer books, hateful/racial speechifying, etc., and also, really bad and or offense behavior. Any-a-ways, I have two such problems in mind for Rosetta Code (and I'm really surprised that no one has introduced them here on RC). I don't feel the time is right to introduce them yet, I still feel Rosetta Code needs to have some maturity in dealing with people who don't agree with their (righteous) opinions. Well, that's my take on it. I don't know if you ever looked up Rosetta Code on Wikipedia, but someone (long ago) entered an entry on Wikipedia, and it was being voted on for removal as (apparently) somebody's nose was out of joint and didn't think it had enough merit to warrant an entry. I got involved and I keep updating the RC entry with vital statistics to show how many updates/edits/entries there are, along with the number of programming solutions and the large number of computer programming languages. The one guy that got permanently banned arrived there and really barfed up the Rosetta Code entry. It took a bit of work to re-establish the RC entry such that it was usable again. That guy hung around longer than a fart in a phone booth. -- Gerard Schildberger (talk) 23:56, 1 December 2019 (UTC)