1
0
mirror of https://github.com/janet-lang/janet synced 2024-12-24 15:30:27 +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

@ -2,6 +2,7 @@
All notable changes to this project will be documented in this file.
## Unreleased - ???
- Add `errorf` to core.
- Add `lenprefix` combinator to PEGs.
- Add `%M`, `%m`, `%N`, and `%n` formatters to formatting functions. These are the
same as `%Q`, `%q`, `%P`, and `%p`, but will not truncate long values.

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))"