The Sands of Time

Random video! Although I feel that I’ve heard it earlier, my first conscious memory of getting linked to it is from this post. At first I thought it would be the right background music for this post, but upon further reflection I think it mainly suited me while I was writing this post. Well, it’s topical if you mentally replace “day” with “year”.

Anyway. Around this time a year ago, I paused my participation in big high-school competitions, for a variety of reasons.

Firstly, I stopped attempting to make IMO both because I wouldn’t get that much from the training and because other people ought to have the opportunity. I was concerned that I might condition myself to only be able to do math with the short-term motivation of contests. Better to focus on college math and maybe some original research, I thought. During the year, I did lots of the former and very little of the latter. Meh.

As for the IOI, my obvious next target: I was tired of training and going abroad while paranoid about whether my immune system would hold up. I didn’t feel that the IOI was worth that. To some degree, I also felt burned out about programming. Long story short, my treatment should end soon, and learning Haskell completely resolved the burnout problem.

But the most important reason, I think, was that “high school was too short”. I started math competitions ridiculously early and didn’t spend much time exploring other interests. I thought I knew myself well enough that I could say I didn’t have many more interests at all, but I was completely wrong (psych nerds will reflexively note this to be the Dunning-Kruger effect). I coded lots in weird languages — Haskell, as mentioned previously, plus Scala, plus all manner of other magical command line tools. I wrote my first math problem and submitted it officially, picked up a new instrument, went to a debate competition, served as an unimportant tech guy for MUN, discovered and became hooked on Pentatonix, participated in three puzzle hunts in Australia and one in Massachusetts, figured out my rough political stance, rode a boat, got retweeted by @eevee and @Kyrgyzstan_News, increased my Neopets™ fortune by over 3400%, and lurked on FurAffinity a little too much.

But now, dear competition world, I’m back.

Continue reading

Printing Woes

(This is one of those entries that got stuck in draft limbo for a really, really, really, really long time. I’m posting it now. Whatever. Also, I seem to be using a lot of dashes now.)

I complain about homework all the time. Who doesn’t? But I know that in reality my homework load is blatantly far from being overwhelming. My math workload is basically as flexible as I need it to be, and I didn’t take APUSH because I couldn’t bear spending twenty-five hours per day on it. But I can still complain about pettier things like how hard it was to print a paper.

There are three steps in the process to produce a nicely printed body of text, be it an essay, a report, fragments of a larger project, or anything else. First, you have to produce the actual content. You string words and punctuation together to satisfy certain grading rubric criteria, and depending on the nature of the project, you might need to add some citations, statistics, pictures, and the like. I guess I’m pretty good at this. Step two is producing a printable document with your content formatted just the right way according to the teacher’s whims: one-inch margins, double-spacing, “five-space indent”, and so on. And finally you have to send your properly-formatted document to the printer and get it onto paper — the simplest step of all. Except when it’s not.

Continue reading

Adventures in Scala Pseudo-Abuse

So, what have I been doing with programming recently?

Scala is an amazing multiparadigm programming language that runs on the Java Virtual Machine and interoperates with Java. I learned about it last time reading random articles on Twitter.

When I say “amazing” I mean “This is a language in which my code gives me nerdgasms every time I read it.” Wheeee.

Okay, it’s not perfect. People say it’s too academic. It has a notoriously complicated type system (which is Turing-Complete at compile time). Its documentation is a bit patchy too. For a serious introduction, the Scala website has plenty of links under documentation, and a tour of features. Somebody wrote another tour that explains things a bit more. So here, instead of introducing it seriously, I’m just going to screw with its features.

Example of freedom. Scala lets names consist of symbols, and treats one-parameter methods and infix operators exactly the same. The full tokenization rules are a bit detailed and I put them at the bottom of this post for the interested. This lets you create classes with arithmetic and domain-specific languages easily, but it also creates some silly opportunities:

scala> val * = 12
*: Int = 12

scala> * * * * *
res0: Int = 1728

Continue reading

Adventures in Meta-Debugging

Okay did I mention how I sucked at the command line? This is part of the journey towards stopping. Yes, I’m on a Mac and it’s not very *nix-y in some ways but it’s enough for me for now.

Today’s story starts when I learned about gdb, the pure-command-line GNU Debugger, which is incredibly cool. I have tried and failed to learn how to use the debug function on many of my IDEs; I found shotgunning printf statements as needed faster. This may well be the first time I found a command-line tool so much more intuitive than the GUI-equipped programs. Wow.

Then I learned that for some reason the gdb on this computer was 6.3, which is 1.2~1.5 major versions behind (depending on how you count) and missing a frustrating amount of features. (The one that the current Code::Blocks installer installs is also something like 6.4. Blech.)

Continue reading