Re-implement all functions in main via fn macro.
This commit is contained in:
@@ -20,18 +20,21 @@
|
|||||||
|
|
||||||
(in-package :main)
|
(in-package :main)
|
||||||
|
|
||||||
(defun read-input (&optional (prompt "> "))
|
(fn read-input (&optional (prompt "> "))
|
||||||
|
(-> (&optional string) string)
|
||||||
(format t "~a" prompt)
|
(format t "~a" prompt)
|
||||||
(force-output)
|
(force-output)
|
||||||
(read-line))
|
(read-line))
|
||||||
|
|
||||||
(defun read-integers ()
|
(fn read-integers ()
|
||||||
|
(-> nil list)
|
||||||
(->> (read-input "Enter numbers: ")
|
(->> (read-input "Enter numbers: ")
|
||||||
(uiop:split-string)
|
(uiop:split-string)
|
||||||
(mapcar (lambda (s) (parse-integer s :junk-allowed t)))
|
(mapcar (lambda (s) (parse-integer s :junk-allowed t)))
|
||||||
(remove-if #'null)))
|
(remove-if #'null)))
|
||||||
|
|
||||||
(defun read-until-integers ()
|
(fn read-until-integers ()
|
||||||
|
(-> nil list)
|
||||||
(let ((inp (read-integers)))
|
(let ((inp (read-integers)))
|
||||||
(while (null inp)
|
(while (null inp)
|
||||||
(format t "Need at least one integer...~%")
|
(format t "Need at least one integer...~%")
|
||||||
|
|||||||
Reference in New Issue
Block a user