0 Replies - 1343 Views - Last Post: 08 July 2011 - 10:02 AM

#1 I X Code X 1   User is offline

  • D.I.C Head
  • member icon

Reputation: 47
  • View blog
  • Posts: 66
  • Joined: 28-July 10

[Lisp] Common Lisp - Alarm Clock

Posted 08 July 2011 - 10:02 AM

Description: Need to download Chronicity via Quicklisp. Will work on any Common Lisp implementation; I used ACL.Given an hour (military time) and an hour, the alarm will be set to that time
(defun set-alarm (h m)
  (loop if (equal 
            (encode-universal-time 0 m h (chronicity:day-of *) 
                                   (chronicity:month-of *) 
                                   (chronicity:year-of *))
                  (get-universal-time))
      return "wake up!"))


; Given an hour and a minute

(set-alarm 13 7)

; It will return a value at that specific time for that day

"wake up!"


; I am using Chronicity which can be used to get the current day/month/etc.

; Encodes the universal time of the time the user entered and loops until
; that time is equal to the actual universal time.


Is This A Good Question/Topic? 0
  • +

Page 1 of 1