Remove non standard range function

Let example define its own range function using do.
This commit is contained in:
madmaurice 2021-04-06 22:11:52 +02:00
parent 7ca4bad9b0
commit cd769b36de
2 changed files with 2 additions and 8 deletions

View file

@ -1,6 +1,4 @@
;; (defun range (start end)
;; (if (< start end)
;; (cons start (range (+ 1 start) end))
;; (list)))
(defun range (start end)
(do ((lst (list) (cons i lst)) (i start (+ 1 i))) ((= i end) lst)))
(write-line (reduce + (filter (lambda (x) (or (zerop (mod x 3)) (zerop (mod x 5)))) (range 1 1000))))

View file

@ -278,10 +278,6 @@ my %stdctx = (
return $number;
},
'range' => sub {
my ($start, $end) = @_;
return [ $start .. ($end-1) ];
},
# String comparison
'string=' => sub { my ($a, $b) = @_; return to_lisp_bool($a eq $b); },