From 535ab8302ba9f584babddf4d787563a3a725cc4a Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Sat, 9 May 2020 11:06:02 -0500 Subject: [PATCH] Add errorf to core. --- CHANGELOG.md | 1 + src/boot/boot.janet | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 35784cd0..03964e93 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/src/boot/boot.janet b/src/boot/boot.janet index dad6ef40..f13cf02e 100644 --- a/src/boot/boot.janet +++ b/src/boot/boot.janet @@ -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))"