small medium large xlarge

Up Front

Ruby as Assembly Language

by Michael Swaine

Generic image illustrating the article

The Simplest Thing That Could Possibly Work

What’s the smallest instruction set that a functional computer could have? The answer is: one instruction. You can build all of logic and computation from combinations a single NOR gate. But would you be crazy enough to do it? Alexander Demin decided the answer was yes, and he shares his experience—and his code—in this issue. Follow along as he builds an assembler and an emulator for a single-instruction CPU and implements a non-trivial algorithm on it, using Ruby as a macro DSL to compile it all.

Apart from that adventure in Ruby-as-assembly-language, we’re highlighting Scala again this issue, with two articles that approach the language very differently. Scala expert Venkat Subramaniam (Programming Scala) continues his tutorial series on the language, looking at Scala’s capabilities for pattern matching. And Brian Tarbox, an unabashed Scala newbie, shares his experience in porting a Java program to Scala.

To Zee Spencer, pair programming is a powerful tool, and you know what can happen if you don’t use power tools carefully. Zee shares four antipatterns of pairing that he’s figured out over the years. Avoid these and this tool will be less likely to bite you.

Also in this issue, John Shade takes on the government and we introduce our latest Pragmatic team member. We hope you enjoy it.

Solution to Last Issue’s Quiz

Last month’s quiz was a really easy cryptogram puzzle. The encrypted words in the first sentence, we said, could be rearranged to form the encrypted words in the second sentence. We asked you to decrypt the two sentences. The sentences were:

“How long before BKGK GMHWDFMB Google for search?” and “The only book in the dining car was GDKWB GMFKHMB.”

Which, decrypted, become:

“How long before SIRI REPLACES Google for search?” and “The only book in the dining car was RAILS RECIPES.”

Download PragPub to Your Kindle Automatically

Thanks to Jason Young, we have an IFTTT recipe to download the latest issue of PragPub to your Kindle when I tweet its announcement. If I didn’t mess it up, this recipe should do the trick.