From 13b4194fca11872d41c19c70897d86324097f446 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Fri, 16 Apr 2021 20:19:35 -0400 Subject: Add .. operator --- bs/core.scm | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'bs') 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 -- cgit v1.2.3