diff options
author | Leah Neukirchen <leah@vuxu.org> | 2023-01-02 18:58:35 +0100 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2023-01-02 18:58:35 +0100 |
commit | 909cf1ba9001f52afbbb6f7cfb6c919869c068ac (patch) | |
tree | 3defa90e042a7228c9d96bbc7cd429c4fa23b726 /mew.scm | |
parent | 5d0b418ffe871b9b1ce8fcdf31786ad737401508 (diff) | |
download | mew-909cf1ba9001f52afbbb6f7cfb6c919869c068ac.tar.gz mew-909cf1ba9001f52afbbb6f7cfb6c919869c068ac.tar.xz mew-909cf1ba9001f52afbbb6f7cfb6c919869c068ac.zip |
add inc!, dec!
Diffstat (limited to 'mew.scm')
-rw-r--r-- | mew.scm | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/mew.scm b/mew.scm index 7707851..845a16e 100644 --- a/mew.scm +++ b/mew.scm @@ -3,13 +3,13 @@ act accumulate andloc app at boolean comp cross-product - dec def del-at div dup + dec dec! def del-at div dup empty? eof esc fail fin final for for/into fun* gconcatenate gen generator-xfold generic-for-each genumerate get gfix giterate gmatch gpick group-by-accumulator gslice-when gsplit gsplit-on gwindow - imp inc inject inject-accumulator into + imp inc inc! inject inject-accumulator into juxt keys len lines loc @@ -1063,6 +1063,20 @@ ((_ location . fs) (set location (=> location . fs))))) + (define-syntax inc! + (syntax-rules () + ((_ location) + (inc! location 1)) + ((_ location n) + (set location (+ location n))))) + + (define-syntax dec! + (syntax-rules () + ((_ location) + (dec! location 1)) + ((_ location n) + (set location (- location n))))) + (define (and=> x . fs) (and x (if (null? fs) |