Saturday, January 23, 2010

install(Erl) ->

It's been a while since I touched it, so I figured I'd download the Erlang reference and language implementation and play around with it. This is also the first time I've played with it while being an admitted Emacs user though (if you go far enough back in the my blog archive, you'll note that my initial reaction to Emacs was something along the lines of "My eyes! The goggles do NOTHING!" [runs away]).

Sounds like a good time to get Erlang mode running inside Emacs rather than having to muck around with erl in the terminal. A search for "erlang mode emacs" links me to the Erlang/OTP site where I found the documentation earlier. Turns out that Erlang comes with its own Emacs mode. I guess the guys and gals over at Ericsson labs are all Emacs hackers too. (As an aside, I also found one post from a user who highly recommended the Erlang emacs mode, even to users of other editors. His advice ran something like "What you'll want to do is type $> vim ~/.emacs and edit that file to include your Erlang path". It was chuckle-worthy, at least.)

Anyway, it turns out that all you really need to do is install Erlang, then add "/usr/lib/erlang/lib/tools-[version number]/emacs" to your load path, and

(setq erlang-root-dir "/usr/lib/erlang")
(setq exec-path (cons "/usr/lib/erlang/bin" exec-path))
(require 'erlang-start)

elsewhere in your .emacs file. note that you'll need to change those directories based on where you installed Erlang (the above are what I had to do after running apt-get install erlang. If you did yours manually, it'll be different).

Once that's done, M-x erlang-mode gets you the right mode, and M-x erlang-shell gets the current buffer running erl.

Tuesday, January 19, 2010

(define little (lambda (

I just got

through my company book-order (I also got The Reasoned Schemer, but I want to finish the first one before I move on).

It's at once an exercise book for Scheme/CL, and the gentlest introduction to recursive programming I've seen. I'm already fairly comfortable with both, so this is really just a refresher for me, but I could see someone new to functional programming (or programming in general) getting some serious mileage out of the text.

If you fit that description and are interested, the Schemer Trilogy is easily worth the $70 Amazon is charging.

EDIT: Ok, wow. I figured I'd breeze through this, given my experience with Scheme and recursion, but 5 chapters in, it's getting pretty interesting. It's obvious that my model of recursion was incomplete if not outright broken earlier, but dammit, I'm progressing. In any case, my point is: even if you think you're fairly familiar with Scheme, consider picking these up.

Sunday, January 17, 2010


I've been getting back to basics.

In terms of programming, I'm mostly mucking around in the bowels of PHP. It's an ok language. You can get things done in it, and it's not intolerable, but...


there's a reason its logo isn't in the header.[1]

The only real reason I'm using the thing at all is that my office is slowly weaning the devs off of Java, and I've simultaneously picked up an independant contract for a LAMP project.

I've also got a project on the burner using Python, but I'm still using Scheme/CL/EL for my personal stuff and Ruby for my various scripting. I get the feeling that Ruby is going to be getting more of my mindshare in the near future as I gear up to start automating some tests for the company.

None of that matters though, because what I've been working on is completely language agnostic. Yes, I'm running through Emacs Extensions at speed, which is making me better at using my editor and customizing it, but I'm also spending about 30 minutes each day on typing practice using Klavaro.

Talk about fundamentals.

It's a bit on the boring side, but here's the thing. Typing with three fingers is slow. That's where I was at a few weeks ago. Granted, because I have a ton and a half of energy, and high endurance, I was still hitting 45 wpm most of the time, but it's inefficient. When I went back to basics, that dropped down to something ridiculous like 18-20wpm, but I'm back in the high-30s/low-40s again. This time with all ten fingers. I'm ultimately hoping to get to 100wpm. This is why I decided to do the training. It's boring, yes, but this set of training is going to ~double my efficiency in all the languages I use. I can't think of anything that'll give me more bang for the buck.

Well, ok, maybe one thing. And I'll get to it. But that's another post.


1 - [back] - EDIT: PHP has since been added to the header.

Friday, January 15, 2010

Happy Hacking

I haven't really talked about my physical setup yet. And it occurs to me that I should, otherwise I'll never think it through properly.

First off, there's my graphic design machine.

It's pretty much exactly what you'd expect. The whole thing is Apple standard (although I did get a Wacom tablet, and Microsoft mouse. Apple doesn't do very good pointing devices as far as I'm concerned). I used the keyboard config to change the Caps Lock key into another Ctrl, but that's it (and it's only relevant in Emacs, since OS X uses Cmd for almost every keystroke where you'd expect to be hitting Ctrl). Nothing to see here.

For travel purposes, I have an HP Mini 1035NR (Which, in spec-terms is basically a Macbook Air with a $1600 instant rebate).

(displaying a PDF of the Emacs Extensions Guide)

I ripped out Windows XP a little while ago and started running Ubuntu. It's great all-round for my purposes. Mostly, I use it to read e-books and practice with Scheme and SBCL on the subway on my way in to work. No hardware mods, although I will note that of all the netbooks I surveyed, this one had hands down the best keyboard layout, especially once I made the customary Caps-Lock/Ctrl switch (can you tell I'm an Emacs user yet?).

Lastly, my hacking machine.

Only a single monitor for now, but I'm getting a second in next week. This is the one that ended up getting that solid-state drive. I've got a Microsoft ergo-keyboard and Trackman trackball for input (although I plan to do some hacking on something a bit weirder soon. I'll let you know how it goes). It goes without saying that the Caps Lock key acts as a second Ctrl.

I've been trying to get to 70wpm lately, and the weird thing is that it seems to be easiest on the netbook. Not because of the keyboard size; it's actually a bit too cramped. Because the keys offer very little resistance, which means I get to type pretty much as fast as I can move my fingers. Given that I switch up the Caps and Ctrl keys on every keyboard I own, I figured I may as well look into a keyboard that does it for me.

Turns out us Canadians can't get it for less than $300, or a friend in a Japanese shipping company. Americans can get it for just under $80, which I would gladly pay, but no dice. Here's the thing though; I've been comparing layouts, and it turns out there's a half-way-decently priced, globally available alternative.

I've been studying the photos like some jackass off CSI: Whatever The Fuck, and I can spot exactly five differences:

  • Small arrow keys instead of the "Happy Hacking" nameplate (Though interestingly, the Happy Hacking Lite 2 has a set of arrows)
  • A row of function keys above the number line (which is nice to have, even though I very rarely use them)
  • Fn key at the bottom left instead of next to the right Shift
  • Escape key moved up in favor of Tilde
  • A Caps Lock key

Also yes, technically the apple keyboard makes you look like a fruity designer-type, while the Happy Hacking keyboard looks more like something used by manly *nix hackers with massive beards.

I'll give the thing a try, but assuming I can re-calibrate it to pretend its Cmd keys actually say Ctrl, it looks like an excellent Happy Hacking stand-in for us Canucks.

Saturday, January 9, 2010

Another look at Emacs

So I said a little while ago, I said I'd switch to jEdit.

It turns out that Emacs has bedeviled me, though, and I've been trying very hard to figure it out. Given my infatuation with LISP in general, it was pretty likely that I'd eventually stumble across the Emacs Extension Guide(pdf).

This appeals to me as perhaps nothing else can. I can develop my programming skills in [a precursor to] my favorite language, while improving the usability of my editor.

The defult usability is still pretty bad in most respects.

  • The arcane shortcuts
  • the insistence on making it ridiculously hard to turn off auto-indent (even in a mode where trying to auto-indent does nothing but raise an error)
  • the requirement that its users know Lisp before using it properly
  • the clumsy initial download (and lack of bundled extensions/modes)

are all obstacles. I'd go so far as to say that if not for these things, Emacs would be the text editor of choice for a majority of computer users rather than just a minority of computer programmers, because underneath that initial crusty façade is raw power unmatched by another editor.

Incidentally, I keep on seeing people complain how "Emacs takes too long to load, so I've switched to Eclipse". I guess I use pretty good hardware, because Emacs never takes more than half a second to open up for me (and I tend to open my editor in the morning then keep it open all day anyway). On the other hand, Eclipse has yet to fully load in under 2 minutes on that very same machine (although, to be fair, the size of my company's codebase might have something to do with that).

In any case, I still don't seem to thirst for the blood of vi users (I'm sure that part comes later), but yeah, I use Emacs.

Friday, January 1, 2010


Happy 2010. I decided to celebrate it by spelling things with bacon and pepperoni. The pizzas were devoured shortly after their construction That's really it, just have a good new year; I'll have more programming thoughts next week.