aboutsummaryrefslogtreecommitdiff
path: root/lib/util.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/util.lisp')
-rw-r--r--lib/util.lisp12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/util.lisp b/lib/util.lisp
index 31e1984..2a6d456 100644
--- a/lib/util.lisp
+++ b/lib/util.lisp
@@ -1,4 +1,4 @@
-;;;; util.lisp
+;;;; util.lisp -- bits and bobs
;; Copyright (C) 2022 Colin Okay
@@ -51,3 +51,13 @@ the directories that appear in the value of that variable."
(ensure-directories-exist pathname)
(with-open-file (out pathname :direction :output :if-exists if-exists)
(print printable-object out)))
+
+(defun read-from-file (path)
+ "Reads one form from the file at PATHNAME, if that file exists. Returns NIL if not."
+ (when (uiop:file-exists-p path)
+ (with-open-file (input path)
+ (read input))))
+
+(defun true-or-false (what)
+ "Returns the strings \"true\" or \"false\" depending on whehter or not WHAT is null"
+ (if what "true" "false"))