Ok I managed to figure out a way to solve it. Is there a better way?
(defun day (n) (mod n 100))
(defun month (n) (mod (/ (- n (day n)) 100) 100))
(defun year (n) (/ (- n (day n) (* (month n) 100)) 10000))
Search found 2 matches
- Sat Aug 30, 2008 7:49 am
- Forum: Common Lisp
- Topic: Beginner question
- Replies: 4
- Views: 10203
- Sat Aug 30, 2008 7:09 am
- Forum: Common Lisp
- Topic: Beginner question
- Replies: 4
- Views: 10203
Beginner question
Hey I just started learning lisp, and there's a problem in my text-book I just can't seem to solve. Hope someone can help out. We have a date in the form yyyymmdd. Define 3 functions year, month and day, which from a date will give the values year, month and day. e.g: (year 19980220) ->1998 (month 1...