A run-in with the garbage men

When you write and run a computer program you are processing data. You load data, create more data, process it and so on. All this data takes up memory on your computer. Without any other action the memory starts to look like a kid's bedroom - all toys, and stale clothes, and empty cans and …

Advertisements

Common Lisp doesn’t yield (but it maps)

I didn't use Python's yield statement until I'd been programming for a few years. Within a few days of learning it, however, I could't live without it. I find Python generators and list/dict comprehensions one of the key things to making Python code compact and readable. I was pretty bummed to learn that Common Lisp …

Common Lisp accessors

The Common Lisp setf function is deceptively humble looking. At the start I didn't think much of it - except that it looked eccentric compared to the assignment syntax from other languages - but recently I've found out how powerful it is, though not quite as convenient as I would hope. In most languages to …

Problem 11

I'm using problems in The Advent of Code 2016 to motivate my study of Common Lisp though, sadly, I've not been devoting time to it recently. Luckily several of my colleagues are also doing the challenge and one of them came by and described what sounded like a particularly interesting problem - number 11 - …

Holy $#!* THAT’s a Lisp macro!

Still struggling to understand what's so special about Lisp, I came across a post linked on lobste.rs, innocuously titled "Hash Table Syntax in Common Lisp". It had the arcane macro syntax I'd seen in some other examples and I was about to skim past it when I suddenly saw the expression {:key1 => "value1", :key2 …

(if (too (many parentheses)) (use parinfer) ‘())

When I first started learning Common Lisp I was a little annoyed by the syntax. After practicing writing Lisp code I have grown to like the simplicity of the basic language. However, like C/C++, even though you don't have to format the code (i.e. add whitespace) it helps readability immensely if you do. In such cases a …

Disassembly

Adventures in functional programming

Reading through Let over Lambda I ran into several instances where the author showed the disassembly of a bit of Lisp code. This struck me as awesome for several reasons and I wanted to do it myself. I initially thought I had to dig up a disassembler for my system (as I would have done it for C/C++) and I was blown away when I learnt that  there was a Lisp command for this!

I found getting the disassembly amazing because I didn’t think of Lisp – a dynamically typed high level language – as generating succinct machine code. I knew it could be compiled, but I expected the compilation to be something very messy, a bit like the C++ code that Cython generates for Python without the types put in – full of instruments to infer types at run time. Instead, what I saw was tight machine code that one…

View original post 186 more words