A new life

On Thursday night, I had the good fortune to be able to reflect on the following fact:

Today I watched the sun rise over the Rockies in my rearview mirror, and set in the eastern forests of California.

This is a topic for an entirely different blog post (which is in the works, but will probably be posted to gopher), but suffice it to say that it represents a major change in my life.

I start a new job tomorrow morning, having moved to a new state (and not entirely certain how things are going to turn out). I’ve also switched over to emacs recently; while a long-time user, it was always a secondary editor I used for Lisp and some writing.

I’d like to start seriously working through technical books again. The new job should satisfy the cryptography and security itches, which will allow me to start working on the other computer science interests of mine. The current book is Paul Graham’s On Lisp. One of the functions that struck me the most was compose:

(defun compose (&rest fns)
  "Compose allows a number of functions with the same arity to be
  composed together in a chain."
  (if fns
      (let ((fn1 (car (last fns)))
            (fns (butlast fns)))
        #'(lambda (&rest args)
            (reduce #'funcall fns
                    :from-end t
                    :initial-value (apply fn1 args))))
      #'identity))

Compose allows a sequence of functions to be chained together; for example, consider an object of type node, with a method node-date to retrieve the timestamp associated with that node. If we wanted to mapcar over a list of nodes to retrieve the year they were published, we could call compose as such:

(mapcar (compose #'timestamp-year
                 #'node-date)
        node-list)

I’m not entirely sure why it caught my fancy, but it did.


Tags: ,