This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-11-25
Channels
- # aleph (2)
- # announcements (7)
- # babashka (6)
- # beginners (53)
- # calva (17)
- # cider (5)
- # clj-kondo (137)
- # cljs-dev (19)
- # cljsrn (14)
- # clojure (74)
- # clojure-conj (9)
- # clojure-europe (13)
- # clojure-houston (1)
- # clojure-italy (16)
- # clojure-nl (21)
- # clojure-spec (3)
- # clojure-uk (9)
- # clojuredesign-podcast (24)
- # clojurescript (85)
- # cursive (11)
- # datomic (28)
- # duct (3)
- # emacs (6)
- # figwheel-main (1)
- # fulcro (68)
- # graalvm (19)
- # graphql (3)
- # joker (32)
- # kaocha (10)
- # lambdaisland (1)
- # malli (50)
- # off-topic (13)
- # other-languages (7)
- # pathom (2)
- # pedestal (14)
- # re-frame (53)
- # reitit (8)
- # shadow-cljs (57)
- # specter (2)
Shouldn’t cljs interop with iterable JS objects such as Set
and Map
via iterator protocol? So (first (js/Set. #js [1 2 3])) ;; 1
would be possible. Clojure allows (first (HashSet.))
iterator-seq
oh, this is cljs, nvm! :)
there’s es6-iterator-seq
indeed
but since Clojure already works with Java collections maybe cljs should be on par as well
There is some really wired lists like https://developer.mozilla.org/en-US/docs/Web/API/FileList that for me just works with (for [i (range (.-length x))] (aget x i))
@souenzzo For array-like collections in js one can use cljs.core/array-seq
iterables are different, though many array-like collection types in browser env might have been already upgraded to iterator protocol (Array for sure)
@roman01la the issue is that CLJS in theory generates ES3 code. that didn't have Map/Set, so if the protocols were extended onto those it wouldn't be ES3 anymore. not sure that it should either. could do it in a simple library.
Maybe it's fine to include this code even if it's not used
@roman01la there's no specific reason other than it hasn't been requested - I think it just means adding a new branch to seq
Submitted a patch https://clojure.atlassian.net/browse/CLJS-3199
we don't care about the specific types of course - just whether it's iterable - has "@@iterator"
property or the actual iterator symbol