Birth announcement (in Lisp)

This is a discussion on Birth announcement (in Lisp) within the lisp forums in Programming Languages category; I've written past birth announcements in C, Perl, and Python. This time, I tried my hand at Lisp. I know it's not beautiful and it's specific to sbcl (because I couldn't figure out cross-implementation multiprocessing in time), but I hope you can appreciate the intent behind it. ; 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 ...

Go Back   Application Development Forum > Programming Languages > lisp

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 09-05-2007, 06:59 PM
Kirk Strauser
Guest
 
Default Birth announcement (in Lisp)

I've written past birth announcements in C, Perl, and Python. This
time, I tried my hand at Lisp. I know it's not beautiful and it's
specific to sbcl (because I couldn't figure out cross-implementation
multiprocessing in time), but I hope you can appreciate the intent
behind it.


; 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 2 of the License, or
; (at your option) any later version.

; 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)
--
Kirk Strauser
Reply With Quote
  #2  
Old 09-13-2007, 10:07 AM
Carlo Capocasa
Guest
 
Default Re: Birth announcement (in Lisp)

My heartiest congratulations and a warm welcome.

Carlo
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 10:59 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.