From 2f966883d92e7433904c3f9038684d723ee1fa82 Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Sat, 20 May 2023 07:42:50 -0500 Subject: [PATCH] Fix #1145 - variadic imperative arith. macros. Also update CHANGELOG --- CHANGELOG.md | 4 ++++ src/boot/boot.janet | 10 +++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 26252642..d9f78e14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog All notable changes to this project will be documented in this file. +## ??? - Unreleased +- Make imperative arithmetic macros variadic +- `ev/connect` now yields to the event loop instead of blocking while waiting for an ACK. + ## 1.28.0 - 2023-05-13 - Various bug fixes - Make nested short-fn's behave a bit more predictably (it is still not recommended to nest short-fns). diff --git a/src/boot/boot.janet b/src/boot/boot.janet index 0ccda788..bdd80f54 100644 --- a/src/boot/boot.janet +++ b/src/boot/boot.janet @@ -147,11 +147,11 @@ (defn dec "Returns x - 1." [x] (- x 1)) (defmacro ++ "Increments the var x by 1." [x] ~(set ,x (,+ ,x ,1))) (defmacro -- "Decrements the var x by 1." [x] ~(set ,x (,- ,x ,1))) -(defmacro += "Increments the var x by n." [x n] ~(set ,x (,+ ,x ,n))) -(defmacro -= "Decrements the var x by n." [x n] ~(set ,x (,- ,x ,n))) -(defmacro *= "Shorthand for (set x (\\* x n))." [x n] ~(set ,x (,* ,x ,n))) -(defmacro /= "Shorthand for (set x (/ x n))." [x n] ~(set ,x (,/ ,x ,n))) -(defmacro %= "Shorthand for (set x (% x n))." [x n] ~(set ,x (,% ,x ,n))) +(defmacro += "Increments the var x by n." [x & ns] ~(set ,x (,+ ,x ,;ns))) +(defmacro -= "Decrements the var x by n." [x & ns] ~(set ,x (,- ,x ,;ns))) +(defmacro *= "Shorthand for (set x (\\* x n))." [x & ns] ~(set ,x (,* ,x ,;ns))) +(defmacro /= "Shorthand for (set x (/ x n))." [x & ns] ~(set ,x (,/ ,x ,;ns))) +(defmacro %= "Shorthand for (set x (% x n))." [x & ns] ~(set ,x (,% ,x ,;ns))) (defmacro assert "Throw an error if x is not truthy. Will not evaluate `err` if x is truthy."