-
-
Notifications
You must be signed in to change notification settings - Fork 19
Labels
component:basilisp.coreIssue pertaining to basilisp.core namespaceIssue pertaining to basilisp.core namespaceissue-type:enhancementNew feature or requestNew feature or request
Description
Hi,
It seems there is an issue with Python generators when they are used directly as the collection in a map function (at least). Specifically, the first and third elements appear to be missing.
To reproduce
- Open the REPL, create a generator that yields a range of numbers, and try to run it through
map identity, the first and third values are missing:
> basilisp repl
basilisp.user=> (defn gen []
(dotimes [i 10]
(yield i)))
#'basilisp.user/gen
basilisp.user=> (map identity (gen))
(1 3 4 5 6 7 8 9)However, if the generator is coarced into a seq, or counted, it behaves as expected.
basilisp.user=> (map identity (seq (gen)))
(0 1 2 3 4 5 6 7 8 9)I would have expected the map function to work the same irrespective of whether the generator was coerced into a seq, or perhaps I'm missing something?
Thanks
Metadata
Metadata
Assignees
Labels
component:basilisp.coreIssue pertaining to basilisp.core namespaceIssue pertaining to basilisp.core namespaceissue-type:enhancementNew feature or requestNew feature or request