Skip to content

Commit 5c5732b

Browse files
committed
Implement -seq for sets the same way as maps
Sets were using iterators instead of just building a list (which were mentioned should be removed in #242), and I guess some of the iterator code doesn't work properly for maps, because executing `(seq #{4 7})` causes a segfault without this patch. I'm not really familar with the implementation of iterators over maps, but this is sort of an interesting bug because I've only been able to reproduce it with sets that have #{4 7} as a subset.
1 parent b8bfe4a commit 5c5732b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pixie/stdlib.pxi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -959,7 +959,9 @@ If further arguments are passed, invokes the method named by symbol, passing the
959959
(fn [v]
960960
(transduce cat unordered-hash-reducing-fn v)))
961961

962-
(extend -seq PersistentHashSet (fn [self] (seq (iterator self))))
962+
(extend -seq PersistentHashSet
963+
(fn [s]
964+
(reduce conj nil s)))
963965

964966
(extend -str PersistentHashSet
965967
(fn [s]

0 commit comments

Comments
 (0)