Skip to content

Commit

Permalink
add drop procedure
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Mar 24, 2024
1 parent 1fcb441 commit 226e659
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
* add `zip` procedure (inspired by [Lodash](https://docs-lodash.com/v4/zip/))
* add `with-input-from-string` and `read-all` [#327](https://github.com/jcubic/lips/issues/327)
* add `#!fold-case` and `#!no-fold-case` directives [#342](https://github.com/jcubic/lips/issues/342)
* add `drop` procedure
### Bugfix
* fix `let-values` to allow binding to list [#281](https://github.com/jcubic/lips/issues/281)
* fix wrong strings in `string-fill!`
Expand Down Expand Up @@ -72,7 +73,7 @@
* fix escape ellipsis in syntax-rules [#334](https://github.com/jcubic/lips/issues/334)
* fix parsing inexact complex without real part and `inexact->exact` procedure [#340](https://github.com/jcubic/lips/issues/340)
* fix `equal?` on cycles [#302](https://github.com/jcubic/lips/issues/302)
* fix Petrifsky let [#341](https://github.com/jcubic/lips/issues/341)
* fix Petrofsky let [#341](https://github.com/jcubic/lips/issues/341)

## 1.0.0-beta.18
### Breaking
Expand Down
1 change: 1 addition & 0 deletions dist/std.min.scm

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

10 changes: 10 additions & 0 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.
10 changes: 10 additions & 0 deletions lib/bootstrap.scm
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,16 @@
(reverse result)
(loop (cons (car lst) result) (- i 1) (cdr lst)))))

;; -----------------------------------------------------------------------------
(define (drop lst n)
"(take list n)

Returns a list where first n elements are removed."
(let loop ((i n) (lst lst))
(if (or (null? lst) (<= i 0))
lst
(loop (- i 1) (cdr lst)))))

;; -----------------------------------------------------------------------------
(define (zip . lists)
"(zip list1 list2 ...)
Expand Down

0 comments on commit 226e659

Please sign in to comment.