Skip to content

Commit

Permalink
Expose chain-from-iter
Browse files Browse the repository at this point in the history
I think I thought that there was no need for this, as
(picl:apply #'picl:chain x) is conceptually equivalent: but that
doesn't work at all when x has infinitely many elements
  • Loading branch information
anlsh committed Jul 12, 2024
1 parent e55635f commit 238d9bd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/package.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

;; Itertools
#:chain
#:chain-from-iter
#:combinations
#:combinations-with-rep
#:compress
Expand Down
4 changes: 4 additions & 0 deletions tests/test-itertools.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@
(f:is (iter-makes '(1 2 3 4 5 6) (chain '(1 2 3) '(4 5 6))))
(f:is (iter-makes '(1 2 3 4 5 6) (chain '() '(1 2 3) '() '(4 5 6) '()))))

(f:def-test test/chain-from-iter ()
(f:is (iter-makes '(0 0 1 0 1 2 0 1 2 3)
(take 10 (chain-from-iter (picl:map (lambda (x) (range x)) (count)))))))

(f:def-test test/zip ()
(f:is (iter-makes (list #(1 2 nil))
(zip '(1) '(2 3 nil) '(nil 4))))
Expand Down

0 comments on commit 238d9bd

Please sign in to comment.