baby.lisp

Wed, Sep 5, 2007 One-minute read

In our household, a baby just ain’t a baby without an appropriately geeky birth announcement. And since Nick is mostly functional – I mean, he can’t exactly type yet – this one is in Lisp. Share and enjoy!

; This program forks().  That should be plenty for a few years' entertainment
; Copyright (C) 2007 Kirk & Jennifer Strauser

; This program is free software: you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation, either version 3 of the License, or ; (at your option) any later version.

; However, the output of this particular instance shall remain ; exclusively licensed to the authors for a period of up to eighteen ; years.

; $Id: baby.lisp 4 2007-09-05 23:18:12Z kirk $

(require :sb-posix)

(defvar birthtime (encode-universal-time 0 20 1 1 9 2007))

(defvar age (- (get-universal-time) birthtime))

(defun hello () (format t “Hello, world! My name is Nicholas Arthur Strauser and this is ~ my ~:r day!~%” (ceiling (/ age 86400))))

(defun labor () (cond ((zerop (sb-posix:fork)) (format t “Ouch!~%")) (t (hello))))

(defun wait () (cond ((< age 0) (sleep (- age)) (setf age 0) (labor)) (t (hello))))

(wait)