Re: Scope Question
- From: Nathaniel Calloway <ntc6@xxxxxxxxxxx>
- Date: Tue, 29 Apr 2008 21:27:35 -0400
dstein64 <DStein64@xxxxxxxxx> writes:
I forgot to mention that I would like the variable to reset itself on
each call to the function (but not on the recursive calls. So in your
example, I would like count to be reset to 0 each time counter is
called from the program. Although there is no recursion in that
example, I would not like count to be reset each time counter is
called recursively by counter.
Is there a problem with passing count back as an argument? If you
don't want to expose count you can just wrap up the recursive part in
labels:
(defun print-10-times (str)
(labels ((recursive-part (times-left)
(when (> times-left 0)
(print str)
(recursive-part (- times-left 1)))))
(recursive-part 10)))
-Nat
.
- References:
- Scope Question
- From: dstein64
- Re: Scope Question
- From: Brian
- Re: Scope Question
- From: dstein64
- Scope Question
- Prev by Date: Re: Scope Question
- Next by Date: iolib/ linux epoll and http servers
- Previous by thread: Re: Scope Question
- Next by thread: Re: Scope Question
- Index(es):
Relevant Pages
|