mirror of
https://github.com/Xevion/lisp-projects.git
synced 2025-12-06 03:15:36 -06:00
change into games and scripts directorys
This commit is contained in:
27
scripts/MonthLength.lisp
Normal file
27
scripts/MonthLength.lisp
Normal file
@@ -0,0 +1,27 @@
|
||||
(defconstant jan 1)
|
||||
(defconstant feb 2)
|
||||
(defconstant mar 3)
|
||||
(defconstant apr 4)
|
||||
(defconstant may 5)
|
||||
(defconstant jul 6)
|
||||
(defconstant jun 7)
|
||||
(defconstant aug 8)
|
||||
(defconstant oct 9)
|
||||
(defconstant sep 10)
|
||||
(defconstant nov 11)
|
||||
(defconstant dec 12)
|
||||
|
||||
(defun isLeapYear ()
|
||||
true
|
||||
)
|
||||
|
||||
(defun month-length (mon)
|
||||
(case mon
|
||||
((jan mar may jul aug oct dec) 31)
|
||||
((apr jun sep nov 30)
|
||||
(feb (if (isLeapYear) 29 28))
|
||||
(otherwise "Unknown Month.")
|
||||
)
|
||||
))
|
||||
|
||||
(print (month-length 'jan))
|
||||
11
scripts/Prompt.lisp
Normal file
11
scripts/Prompt.lisp
Normal file
@@ -0,0 +1,11 @@
|
||||
(defun read-3-numbers-&-format-sum ()
|
||||
(flet ((prompt (string)
|
||||
(format t "~&~a: " string)
|
||||
(finish-output)
|
||||
(read nil 'eof nil)))
|
||||
(let ((x (prompt "first number"))
|
||||
(y (prompt "second number"))
|
||||
(z (prompt "third number")))
|
||||
(format t "~&the sum of ~a, ~a, & ~a is:~%~%~a~%"
|
||||
x y z (+ x y z)))))
|
||||
(read-3-numbers-&-format-sum)
|
||||
Reference in New Issue
Block a user