Skip to content

Commit

Permalink
std/iter: use #f for default finalizer and check in iter-fini!
Browse files Browse the repository at this point in the history
turns cross-module calls in the default construction into a boolean check.
  • Loading branch information
vyzo committed Nov 12, 2019
1 parent f1ab42e commit bea4bca
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/std/iter.ss
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
constructor: :init! unchecked: #t final: #t)

(defmethod {:init! iterator}
(lambda (self e next (fini void))
(lambda (self e next (fini #f))
(struct-instance-init! self e next fini)))

(defstruct :iter-end ())
Expand Down Expand Up @@ -218,10 +218,12 @@

(def (iter-fini! it)
(declare (not safe))
((&iterator-fini it) it))
(@iter-fini! it))

(defrules @iter-fini! ()
((_ it) ((&iterator-fini it) it)))
((_ it)
(cond
((&iterator-fini it) => (cut <> it)))))

(def (iter-filter pred it)
(def (iterate)
Expand Down

0 comments on commit bea4bca

Please sign in to comment.