We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(defun |tee| (iterable &optional (n 2)) "Create N independent generators" (check-type n integer) (cond ((zerop n) (make-tuple-from-list ())) (t (let ((iter-func (clpython::get-py-iterate-fun iterable)) (deques (loop repeat n collect (clpython.module._collections:|deque|)))) (flet ((generator (deque) (clpython::make-iterator-from-function :name :tee-iterator :func (lambda () (if (clpython::py-val->lisp-bool deque) (clpython.module._collections::deque.popleft deque) (let ((new-val (funcall iter-func))) ;; also continue if NEW-VAL is NIL (dolist (d deques) (unless (eq d deque) (clpython.module._collections::deque.append d new-val))) new-val)))))) (make-tuple-from-list (mapcar 'generator deques)))))))
Probably the MAPCAR should use #'generator and not 'generator
The text was updated successfully, but these errors were encountered:
Fix itertools.tee (issue #24)
0f47bf7
Thanks, it's corrected in commit 0f47bf7. Allegro CL did the wrong thing by using the FLET binding, hiding the error for me.
Sorry, something went wrong.
No branches or pull requests
Probably the MAPCAR should use #'generator and not 'generator
The text was updated successfully, but these errors were encountered: