Lisp newbie needs help
From: Valentin Hans (ValHa_at_web.de)
Date: 09/30/04
- Next message: Kenny Tilton: "Re: Query: Who cares about DFSG lisp?"
- Previous message: kodifik: "Re: how to pronounce these names"
- Next in thread: William Bland: "Re: Lisp newbie needs help"
- Reply: William Bland: "Re: Lisp newbie needs help"
- Reply: Max-Gerd Rettzlaff: "Re: Lisp newbie needs help"
- Reply: Daniel Lowe: "Re: Lisp newbie needs help"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 30 Sep 2004 07:26:30 -0700
Hello,
regarding Lisp programming I am an absolute newbie. I just started
learning Common Lisp a few days ago and I have got a problem. I wanted
to write a small game and my code contains the following function that
throws a dice until the thrown number is a "1". However, CLISP (I am
using version 2.33) never prints "One thrown". Could anyone please
figure out why this is so?
(defun my-test (&aux (sum 0))
(do () (nil nil)
(let ((number (+ (random 6) 1)))
(if (= number 1)
(format t "~&One thrown." (setf sum 0) (return)))
(format t "~&~D thrown. Sum: ~D" number (incf sum number)))))
(I know that "sum" is quite useless here; the function above is just a
stripped down version of the function I am using)
- Next message: Kenny Tilton: "Re: Query: Who cares about DFSG lisp?"
- Previous message: kodifik: "Re: how to pronounce these names"
- Next in thread: William Bland: "Re: Lisp newbie needs help"
- Reply: William Bland: "Re: Lisp newbie needs help"
- Reply: Max-Gerd Rettzlaff: "Re: Lisp newbie needs help"
- Reply: Daniel Lowe: "Re: Lisp newbie needs help"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]