diff options
author | Leah Neukirchen <leah@vuxu.org> | 2022-11-17 22:05:04 +0100 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2022-11-17 22:05:04 +0100 |
commit | ce0aeb4a774511bfbd9ea06b056d3c9b63700934 (patch) | |
tree | f475ddcf73d74f083bb0fb89907c1bdd0b697400 | |
parent | 2f6a20240df228e71503c2dc1e3a41e75d50f54b (diff) | |
download | mew-ce0aeb4a774511bfbd9ea06b056d3c9b63700934.tar.gz mew-ce0aeb4a774511bfbd9ea06b056d3c9b63700934.tar.xz mew-ce0aeb4a774511bfbd9ea06b056d3c9b63700934.zip |
add range without arguments
-rw-r--r-- | mew.scm | 1 | ||||
-rw-r--r-- | mew.svnwiki | 7 | ||||
-rw-r--r-- | tests/test.mew | 1 |
3 files changed, 7 insertions, 2 deletions
diff --git a/mew.scm b/mew.scm index 7756746..51c3e47 100644 --- a/mew.scm +++ b/mew.scm @@ -389,6 +389,7 @@ (define range (case-lambda + (() (make-range-generator 0 +inf.0 1)) ((start) (make-range-generator start +inf.0 1)) ((start end) (make-range-generator start end 1)) ((start end step) (set! start (- (+ start step) step)) diff --git a/mew.svnwiki b/mew.svnwiki index 03d91c7..c248917 100644 --- a/mew.svnwiki +++ b/mew.svnwiki @@ -349,9 +349,12 @@ Generic generator for list/vector/string/hash-table/generator. Alias for {{circular-generator}}. -<procedure>(range <start> <end>? <step>?)</procedure> +<procedure>(range <start>? <end>? <step>?)</procedure> -A variant of {{make-range-generator}} that also allows negative {{step}}. +A variant of {{make-range-generator}} that also allows negative {{<step>}}. +{{<start>}} defaults to zero. +{{<end>}} defaults to infinity. +{{<step>}} defaults to 1. <procedure>(giterate <fun> <val>)</procedure> diff --git a/tests/test.mew b/tests/test.mew index b895780..daeffc1 100644 --- a/tests/test.mew +++ b/tests/test.mew @@ -31,6 +31,7 @@ (test '(1 3 5) (into '() (range 1 7 2))) (test '(3 2 1) (into '() (range 3 0 -1))) (test '(2 3 4) (into '() (gtake (range 2) 3))) + (test '(0 1 2) (into '() (gtake (range) 3))) (test '(1 3/2 2 5/2) (into '() (gtake (range 1 +inf.0 1/2) 4))) (test '(1 1 1 1) (into '() (gtake (range 1 +inf.0 0) 4)))) |