Hi,

I'm looking at the following function from a common-lisp project called 
"clon" (a task scheduler library by Gabor Melis <http://www.cliki.net/Clon>). 
 I've been trying to port the project to better understand how it works and 
also to learn Clojure:

(defun make-scheduler (schedule &key (now (get-universal-time))
                       allow-now-p (limit *default-next-time-limit*))
  "Return a `scheduler' function of no arguments that returns times         
                                                                 
from NOW on by repeatedly calling NEXT-TIME on SCHEDULE. ALLOW-NOW-P       
                                                                  
is passed to the first invocation of NEXT-TIME."
  (lambda ()
    (prog1
        (setf now (next-time schedule :now now :allow-now-p allow-now-p
                             :limit limit))
      (setf allow-now-p nil))))

I can't figure out how to get around "setf" in above.  Please help.

Notes on context: 

   1. *default-next-time-limit* is a date set to 3000/1/1.
   2. next-time is a function that returns... the next time a job gets 
   triggered, based on the schedule.
   3. schedule is a CLOS object...  I've not thought about what to do with 
   it in Clojure.  Any advice?
   

Other miscellaneous questions:


   1. For "&key", I referenced this 
page<http://clojurefun.wordpress.com/2012/08/13/keyword-arguments-in-clojure/>. 
    Is there a better way?
   2. I already have "prog1" for clojure.  Copied and pasted the macro from 
   here <https://groups.google.com/d/msg/clojure/Yyf_AyyyVs0/J8AVYGU5gIUJ>. 
    Is there a better way?
   

Thank you.

Michi Oshima

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to