1
0
mirror of https://github.com/janet-lang/janet synced 2025-11-06 10:33:03 +00:00

Add errorf to core.

This commit is contained in:
Calvin Rose
2020-05-09 11:06:02 -05:00
parent 1add0c7d43
commit 535ab8302b
2 changed files with 6 additions and 0 deletions

View File

@@ -141,6 +141,11 @@
[x &opt err]
(if x x (error (if err err "assert failure"))))
(defn errorf
"A combination of error and string/format. Equivalent to (error (string/format fmt ;args))"
[fmt & args]
(error (string/format fmt ;args)))
(defmacro default
"Define a default value for an optional argument.
Expands to (def sym (if (= nil sym) val sym))"