aboutsummaryrefslogtreecommitdiff
path: root/src/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lisp')
-rw-r--r--src/lisp/core.lisp.in6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lisp/core.lisp.in b/src/lisp/core.lisp.in
index 46d5306f..3ecb6c48 100644
--- a/src/lisp/core.lisp.in
+++ b/src/lisp/core.lisp.in
@@ -101,6 +101,7 @@
"prettyPrint"
"readLine"
"readExpr"
+ "readIntegerIfCan"
;; compiler data structures
"%Mode"
@@ -527,6 +528,11 @@
(defmacro |readExpr| (f)
`(read ,f nil |%nothing|))
+(defun |readIntegerIfCan| (s)
+ (let ((r (multiple-value-call #'cons (parse-integer s :junk-allowed t))))
+ (cond ((eql (cdr r) (length s)) (car r))
+ (t nil))))
+
;; Pretty-print a lisp form on a given output stream.
(defun |prettyPrint| (x &optional (s |$OutputStream|))
(let ((*print-pretty* t)