~tim/scheme-vm

11e6d2b31c3c25833652c4f4d7ee0f9ccebd036b — Tim Morgan 2 years ago 0e21d1d
Just add a library that will be helpful later
1 files changed, 10 insertions(+), 0 deletions(-)

A lib/range.scm
A lib/range.scm => lib/range.scm +10 -0
@@ 0,0 1,10 @@
(define-library (range)
  (import (only (scheme base) define letrec >=))
  (export range)
  (begin
    (define (range first last)
      (letrec ((r (lambda (n1 n2 l)
                    (if (>= n1 n2)
                      l
                      (r n1 (- n2 1) (cons (- n2 1) l))))))
        (r first last '())))))