The book that changed my development career now has a Javascript version
Tags: javascript, functional, career, programming
Published: 2022-04-25 12:04:44

---
title: The book that changed my development career now has a Javascript version
published: true
description: "SICP JS Cover"
tags: javascript,functional,career,programming
cover_image: https://repository-images.githubusercontent.com/133972976/7961000c-a449-4aff-b6e4-422109a8f0fd
---

## From BASIC and C teenage hacker...

![SICP book cover](https://mitpress.mit.edu/sites/default/files/sicp/full-text/book/cover.jpg)

When I was a teenager, I used to program in QBasic, assembler and C. I had tremendous fun: I was sitting at my computer yet creating universes.

In QBasic you would write a program, run it, and get to play with it immediately (I mostly wrote games). Because we only had a very old DOS computer without a graphics card and hard drive, the only other programming tool I had access to was a program called debug.com that allowed you to mess with the program memory, and enter your own assembly code (you had to do the assembling by yourself). It was oh so painful, but I learned how a CPU works. It also made me want to never translate assembly to binary ever again.

Once I could afford an old second-hand pentium 133 Mhz, I installed linux and started to learn C. I wanted to become a hacker, sp0k3 l1k3 th1s on IRC, and had tremendous fun learning about compilers and operating systems and memory layouts.

## To aspiring functional programmer...

![Lambda (courtesy Wikipedia)](https://upload.wikimedia.org/wikipedia/commons/3/33/03BB-500x500.png)

But in the early 2000s, a chance encounter on IRC changed my development career. A german programmer (hi forcer if you ever read this!) recommended I read this book called "Structure and Interpretation of Symbolic Programs", by Abelson, Sussman and Sussman.  It is [freely available online](https://mitpress.mit.edu/sites/default/files/sicp/full-text/book/book-Z-H-1.html#titlepage).  It is a both a dry and formal book, and a very immediate book, because every code example is immediately executable. I dove right into it, and a few weeks later had built [an obnoxious IRC bot](https://web.archive.org/web/20050204005827/http://rocloiso.planet-d.net/larve/weedy/) to administer my channels.  I later found some very clear lecture videos online, now available on [MIT's youtube](https://www.youtube.com/watch?v=2Op3QLzMgSY).

## From lambda to a VM and compiler

![Metacircular Evaluator (courtesy Cornell)](https://www.cs.cornell.edu/courses/cs212/1998sp/images/CS212_icon.gif)

In a minimalistic language called [Scheme](https://en.wikipedia.org/wiki/Scheme_(programming_language)), the book walks you through building programs from the simplest mathematical concepts: abstractions, evaluation rules, combining smaller functions into bigger functions. It implements everything with functions, and teaches you how functions are things you can compose and manipulate. This might seem obvious to someone growing up with Javascript, but for someone coming from C, for whom a function was basically a goto that could return, this was absolutely groundbreaking.

Things become really fun in the second chapter, where you build different mathematical algorithms. Who knew that a lot of differentiating and integrating was pretty much the manipulation of a fairly simple data structure! Coming from C, where even using an array is a painful and dangerous things, this concept of data structures and implementing them using functions was absolutely mind-shattering. Suddenly code was data and data was code.

By the third chapter, you implement stateful structures, a digital circuit simulator, infinite lazy streams, deal with concurrency at a symbolic level, all still just using Scheme, that minimalistic functional language. In the fourth chapter, the one that caused me the most problems at first, and completely shifted my brain, you implement a scheme interpreter in... scheme. And you then manipulate that interpreter in many interesting ways: probabilistic computations, logic programming, lazy evaluation. It shows you how easy these ideas are to actually implement, and how implementing them is the best way to learn how they work. This opened up an entire world to me. After this chapter, I was not intimidated by building my own languages, compilers, symbolic program manipulations, code generation. I knew there was a very elegant foundation that I could come back to.

In chapter five, you implement the culmination of all of this hard work: building a virtual machine, garbage collector, an efficient machine-optimized interpreter and finally a scheme compiler. In one book you went from what seems trivial functions to a full VM with compiler and garbage collector.

## This book changed my career
![Galaxy brain, courtesy wikicommons](https://upload.wikimedia.org/wikipedia/commons/thumb/1/1d/Galaxy_brain_male_stage_3.png/800px-Galaxy_brain_male_stage_3.png?20210831144526)

In [a beautiful foreword](https://sourceacademy.org/sicpjs/foreword02), Guy Steele writes about the history of programming languages, and how Javascript stands on the shoulders of giants. And I can only agree. To this day, and in all my web development endeavors, I still innerly think in scheme and abstract functions.

I am now not afraid to write functional code in the midst of a big mess of PHP. I am not afraid to introduce ideas from compiler theory, DSLs, interpreters, virtual machines into my day to day life, because I know how simple and elegant they can be expressed. It gives me the confidence to tackle daunting languages like Haskell, more experimental languages like Elm, or esoteric topics like formal theorem proving. It sheds light on the inner workings of many modern frameworks, not least React, which borrows a lot from functional programming and the concepts explored in this book. 

After reading this book, I became a Common Lisp web developer, writing one of the [first transpilers for Javascript out there](https://bknr.common-lisp.dev/pdf/js-manual.pdf). With my colleague Hans Hübner and his forward thinking ideas (he was writing SPAs in the early 2000s), we wrote the [BKNR web framework and database](https://bknr.common-lisp.dev/html/home.html). With just two programmers, we built our own web server, database, frontend framework, XML import/export, templating language, constraint driven graphics layout and much more. 

I wrote my own [optimizing assembler for the Z80 CPU]([https://github.com/wesen/z80-asm/blob/master/asm-z80.lisp), which we used to control a speech synthesizer chip. Later on, I wrote my [own CAD/CAM software to control a CNC mill](https://github.com/wesen/cl-mill), automatically generating the front panels for my electronic circuits. I wrote an [algorithmic movie editor](https://github.com/wesen/schnitt) (that one is a proper mess...). I then moved away from Common Lisp to much more down to earth bare-metal C++, PHP and javascript, but I never left Scheme and functional programming behind. To this day, it informs everything I do, and one day I know I'll come back.

None of this would have happened if I hadn't worked through SICP.
It really opened my eyes to the beauty of programming, and how effective understanding the elegant fundamentals can be.

## And it's now available in Javascript!
![SICP JS cover](http://source-academy.github.io/sicp/sicpjs.png)

Back in the days before the internet turned to the big ball of craziness it is nowadays, it was fairly easy (well, just as easy as you could get) to get started with Scheme. You would install guile, and emacs, and get rocking. 

These days, we don't even need that. We have all this wonderful environment right here in our browser, and javascript is a language that allows you to manipulate functions just as easily. It's no big surprise that a book that is about the core ideas of programming, about the elegance of functions and the power that comes with them, is now available with Javascript examples, all available [for free on their website](https://sourceacademy.org/sicpjs/index).

In some way, I miss the elegant syntax of scheme, but I am sure that the move to Javascript will help bring this amazing book to the wide, vibrant, diverse javascript developer community. 

So what are you waiting for! Fire up your editor, go to [SICP JS](https://sourceacademy.org/sicpjs/) and change your life!

## What about you?

Do you have any books that changed your career? Do you think functionally, but write imperatively? How long did it take you to understand the meta-circulator evaluator? Do you think you could implement a garbage collector in just a few functions?