Skip to content

Commit

Permalink
fix range #442
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Feb 23, 2025
1 parent 90b9cce commit d17bdc3
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
## 1.0.0-beta.21
### Breaking
* `(range n 0 -1)` don't include 0 like in Python [#442](https://github.com/jcubic/lips/issues/442)
### Feature
* allow to use auto-indent with Node >=18.19.0
* add metadata to the parser [#414](https://github.com/jcubic/lips/issues/414), [#416](https://github.com/jcubic/lips/issues/416)
Expand Down
4 changes: 2 additions & 2 deletions dist/std.min.scm

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 6 additions & 7 deletions dist/std.scm

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified dist/std.xcb
Binary file not shown.
8 changes: 4 additions & 4 deletions lib/bootstrap.scm
Original file line number Diff line number Diff line change
Expand Up @@ -1317,15 +1317,15 @@
If start is not defined it starts from 0. If start is larger than stop
the step needs to be negative otherwise it will hang in an infinite loop."
(let* ((i (if (null? rest) 0 stop))
(stop (if (null? rest) stop (car rest)))
(step (if (or (null? rest) (null? (cdr rest)))
1
(cadr rest)))
(stop (if (null? rest) stop (car rest)))
(test (cond
((> i stop) (lambda (i)
(and (< step 0) (>= i stop))))
((< i stop) (lambda
(i) (and (> step 0) (< i stop))))
(and (< step 0) (> i stop))))
((< i stop) (lambda (i)
(and (> step 0) (< i stop))))
(else (lambda () false))))
(result (vector)))
(typecheck "range" i "number" 1)
Expand Down

0 comments on commit d17bdc3

Please sign in to comment.