2019-04-21

I finally decided to stop screwing around and start going after the things I'm interested in. Right now, that means maths and Erlang. Math, because it's the one topic that seems to be the linchpin for unlocking a bunch of things; and Erlang, because it's one of the two languages with a community that I wish I was a part of [1] (the other is Clojure) - communities with smart, generally compassionate and thoughtful people. With Joe Armstrong's passing, it has me reconsidering a lot of things [2] and one of those is focusing on these things. I need to bullet journal what my goals are and how these fit in and how I get there, but right now it looks like my future is maths and Erlang.

I'm deliberately breaking my "one-book-per-category" goal to start reading PIM [3], whose problem sets will take some thinking and work, and Programming Erlang, Joe's 2013 book on Erlang. After this, I might look into Elixir. The GRiSP2 is going to be shipping later this year (it should be funded within a week) and I'm going to need to program it with something [4].

So, working through the whirlwind tour that has you making a file server, Joe leaves us with the exercise to add file uploads ("find out how to consult manual pages. Consult the manual pages for the file module.") and I spent maybe 30 minutes trying to debug why mine would hang.

  1. First, I tried calling my put_file directly - this worked, so it was in the client.
  2. At first I thought it was a message mismatch, but the client's call matched my call in the shell, so
  3. The receive was where it had to be but I was just doing the equivalent of receive {Server, Response} -> ...
  4. Except it was actually receive {Server, response} -> ...

Since the atom response was never being matched, the receive just hung. Lesson learned - always have a default case [5]. I imagine this is valuable experience to have debugging a problem I will likely make again.

I've been working on writing out proofs, but I'm not sure I'm doing them right. I need to find a maths mentor, I suppose.

[1]I've never had the fortune of being part of a technical community that helped me grow. I feel like I've missed out not being a part of these communities.
[2]I have a blog post stewing with the draft title "Happier Days" where I go into the things that made me happy about computers and why that's not now.
[3]A Programmer's Introduction to Mathematics.
[4]It'd be cool to write a basic operating system on it :)
[5]Except reading later, I see "our function does not handle the case where no pattern matches... this is deliberate. This is the way we program in Erlang." I have a lot yet to learn.

Tags: