diff options
author | Ben Sima <ben@bsima.me> | 2021-04-16 20:19:35 -0400 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2021-11-26 13:47:33 -0500 |
commit | 13b4194fca11872d41c19c70897d86324097f446 (patch) | |
tree | 75817897500c8d36550bc30e1fa1fc20e68a41a6 /bs/core.scm | |
parent | 7870a19fa4de5a478aec7e071f18cdaaefe7d5f4 (diff) |
Add .. operator
Diffstat (limited to 'bs/core.scm')
-rw-r--r-- | bs/core.scm | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/bs/core.scm b/bs/core.scm index d8e0060..61ee8cc 100644 --- a/bs/core.scm +++ b/bs/core.scm @@ -148,6 +148,13 @@ [(_ (binding value) body ...) (when binding body ...)])) +;; range operator from http://www.mattknox.com/code.html +(define (.. l h . s) + (let* ((step (if (null? s) 1 (car s)))) + (if (> h l) + (range l h step) + (reverse (range h l step))))) + ;; source utils |