Learn A New Language
May 31, 2016
It’s fun to learn new programming languages. It’s also useful, even if you never use the new language, because it forces you to think differently about how you do things.
Your task is to write a familiar program in an unfamiliar language. When you are finished, you are welcome to read or run ([1], [2]) a suggested solution, or to post your own solution or discuss the exercise in the comments below.
Go, really? The only reason this language hasn’t fallen into oblivion is that it has Google behind it. If it were to compete in fair terms with other languages today, it is bound to fail to make the cut.
Here is the equivalent code for factoring an integer in Julia:
factor(13290059)
As for the primes:
primes(n)
Note that it doesn’t need to import any libraries either, while its performance is comparable to C. So, if you want to learn a new language, do yourself a favor and learn something useful.
Also, since when is 170296465834288046421517 a big Int? Is Go’s memory management so feeble that it can’t handle a 78 bit integer?
Dr. Z., there is no call for such rudeness.
Incidentally, Julia developers have moved these functions out of Base. Need to be imported, they will.
Thanks for the defense, Jussi. I generally ignore folks like him. If he does it again, he will be banned.