Day 18: I know nothing

Nick Ang
getting technical
Published in
6 min readJul 18, 2016
The spectator kitchen in a Paradise Dynasty restaurant.

“You know nothing, Jon Snow.”— Ygritte, Game of Thrones

Today, a part of me felt like Jon Snow. I found The Little Schemer by Friedman and Felleisen in the mail at about 3pm (I placed an order with Bookdepository.com a little over a week ago), and boy has my world expanded. In fact, it’s so big now that I’m not sure where I stand in it. Hopefully this is temporary.

Here’s how my day from 3pm transpired:

  • Feeling pumped to start, having read this Reddit post tooting about how this book will help you fast-forward a foray into virtual reality programming. Read the foreword and preface with a grin hanging on my face. “Mm, look at me. This is a technical book on programming. How sexy am I!”
  • Flipped to the start of the body of the book and suddenly, my brain stopped in its tracks. “What the hell is this?!”
  • Took 5 minutes to realise that the authors had no intention of going through the basics of Lisp/Scheme upon which their book was built. “Do I have to pick up a whole new language?! Okay, maybe not, they said in the preface that only a few methods will be used in the exercises…”
  • Realised the hilarity of the situation and laughed at myself. “You seriously know nothing this time.”
  • Started googling and stumbled on a great online resource maintained by Berkeley.edu. Search term was “What is an atom in Scheme”. Started reading from chapter 1. “All this code looks so cryptic and clumsy… but there has to be something in here. Didn’t Paul Graham build his company Viaweb on Lisp?”)
  • Figured out the best way to approach this is to run my brain on the book in parallel to my laptop on google. Encounter new syntax → google → apply new conceptual understanding → do exercise → encounter new syntax. “Hey look! That’s recursion!”

I’ve got to admit, the book looks like a colouring book for children ages 2 to 5. What? It does!

Told you it looks like a children’s colouring book.

But inside the book is a trove of mental exercises (so far they can be done mentally) that looks like they are designed to help anyone grasp the fundamentals of computer science in terms of how a computer structures data, reads a list and recognises patterns, and so on. I think ‘recursion’ is a big theme in the book, though it remains elusive to me at this point.

To give you an idea of the syntax of Scheme (a variant of Lisp) though…

  • ‘car l’, where l is the list of atoms (a b c), returns ‘a’. ‘car’ apparently is the method to identify the first element in an array of some sort. Nothing to do with an actual car.
  • ‘cdr l’, where l is the same list of atoms (a b c) will return (b c). ‘cdr’ is the method to identify everything else in an array excluding the first. (More on these primitives here.)
  • “4 == (2 + 2)” in C is represented as “(= 4 (+ 2 2))” in Lisp
The Little Schemer’s format is a dialogue in two columns, question and answer.

To be honest, I don’t know what lessons I can draw from learning these specific things about Lisp/Scheme at this point. I suppose I’ve learned that by being able to identify the first element in a list of elements (or in Lisp-speak, ‘atoms’), a programme can also by reverse logic identify all other elements except the first element. And by combining the two, a programme can identify the second item in a list by finding the first item in the remaining list of items, and so on.

That’s a cool revelation that gave me a glimpse under the virtual hood of the very machine I’m banging keys on right now. I can see how it might help me become a programmer…?

Manipulating any webpage

Berkeley.edu’s webpage on Lisp is a fantastic resource set up in 1999. That it is still useful as a reference in 2016 is quite remarkable, especially considering how internet years are 10x actual human years. But you know how 1999 webpages look like, right?

I was trying to read all that text on their page and got fed up because my millennial eyes and brain are accustomed to reading webpages with negative space on the left and right so that words don’t run on and on from edge to edge on a screen. User experience in 1999 wasn’t a priority, I suppose.

Then a whacky idea hit me and I had to try it. Could I manipulate the DOM (document object model, the $10 word for “the way a webpage is structured”) on my browser, and change the margins of the page? I was sure after all that a webpage in 1999 was also written in HTML.

I’ve fiddled with the developer console in Chrome before when learning JavaScript, so I brought it up. I remember how jam-packed it looked. I had only ever used the console and the element-picker features, the rest just ornaments that made me look like a badass computerphile to neighbours at Starbucks.

Sure enough, I could do it! I manipulated the DOM of a page on berkeley.edu and added margins to the ‘body’ CSS…

Manipulating the DOM.

My whacky idea turned out to be feasible and easy to execute. Without my knowledge of HTML and CSS and the DOM, though, I would never have thought that it is possible to change what someone else’s website looks like.

But I did it. You can do it too. Anyone can, because a website consists of webpages, and a webpage is essentially a series of files (with code and images and other things) that are fetched from a server via the internet, interpreted by your browser, and displayed on your screen in the browser. Once the webpage is loaded in your browser, the code and files live in your browser, and you are free to change any of it as you please. Changes made are only effective in that session.

I showed off my newfound magical powers to Mei and I think it impressed her a bit. I felt on top of the world for a full minute and rejoined my physical body. Probably just cheap thrill to developers out there, but it was an achievement for me.

Photos from today’s life

Foodpanda, an Uber for food, is really becoming a thing here in Singapore…
My time poison during learning breaks.
Lovely watercolour mural at a Korean restaurant near where I live.

This post is part of my 30-day commitment to write about my journey learning technical stuff. If you learned something, please recommend it so that more of us can share our learning.

Posts are published to Getting Technical.

--

--

Nick Ang
getting technical

Software Engineer. Dad, rock climber, writer, something something. Big on learning everyday.