| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| 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 |
|
#2
| |||
| |||
| My heartiest congratulations and a warm welcome. Carlo |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.