commit 531c97634da9a15e9d1f865d5d50ef25cd58ba5c
parent 8eec941624c1c1b8cc600b0885760beb97047f7a
Author: Ed van Bruggen <edvb@uw.edu>
Date: Fri, 20 Mar 2020 18:25:03 -0700
Add increment and decrement macros
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/tibs/lib.tsp b/tibs/lib.tsp
@@ -335,6 +335,11 @@
(define (logb b x) (/ (log x) (log b)))
(define (log10 x) (logb 10. x))
+(defmacro (++ x . n)
+ `(set! ,x (+ ,x ,(default n 1))))
+(defmacro (-- x . n)
+ `(set! ,x (- ,x ,(default n 1))))
+
; define inverse trig functions
(let (((def inv func)
(eval (list 'define (list inv 'x) (list '/ (list func 'x)))))