I've found this (http://dev.clojure.org/jira/browse/CLJS-664) while searching 
on Jira. Travis included a patch that looks good and does exactly what you 
suggested for the patch. Can it be merged for the next release?

On Tuesday, January 14, 2014 3:23:27 PM UTC+1, David Nolen wrote:
> This is a known bug we can't reliably check that something is an array via 
> the Array constructor in Node.js. We need to emit a different array? 
> predicate that uses Array.isArray when targeting Node.js. Patch for this 
> welcome.
> 
> 
> 
> In the meantime you can fix it in your own code by extending IEncodeClojure 
> to default and using the Array.isArray check yourself to catch this case.
> 
> 
> 
> David
> 
> 
> 
> 
> On Tue, Jan 14, 2014 at 8:13 AM, Joaquín Oltra <[email protected]> wrote:
> 
> Hi!
> 
> 
> 
> I have an issue when trying to convert a javascript Array to a clojurescript 
> vector. When using js->clj it returns the same JS object without converting 
> it.
> 
> 
> 
> Code:
> 
> 
> 
>   (def paths (.readdirSync fs "resources/photos"))
> 
>   ;=> #<.DS_Store,2013,Aachen,Alicante,India Maria,Londres 2009>
> 
> 
> 
>   (isa? paths js/Array)
> 
>   ;=> false
> 
> 
> 
>   (type paths)
> 
>   ;=> #<function Array() { [native code] }>
> 
> 
> 
>   (print (js->clj paths))
> 
>   ;=> #<.DS_Store,2013,Aachen,Alicante,India Maria,Londres 2009>nil
> 
>   ;; Same thing as before
> 
> 
> 
>   (map #(str "whatever") paths)
> 
>   ;=> "Error evaluating:" (map (fn* [] (str "asdf")) paths) :as 
> "cljs.core.map.call(null,(function (){return 
> [cljs.core.str(\"asdf\")].join('');\n}),galeria.files.paths)"
> 
> 
>   Error: .DS_Store,2013,Aachen,Alicante,India Maria,Londres 2009is not 
> ISeqable
> 
>     at seq (cljs/core.cljs:39:9)
> 
>     at cljs.core.map.map__2 (cljs/core.cljs:11:120)
> 
>     at cljs.core.LazySeq.sval (cljs/core.cljs:43:23)
> 
>     at cljs.core.LazySeq.cljs$core$ISeqable$_seq$arity$1 (cljs/core.cljs:55:30
> 
>   ....
> 
> 
> 
> 
> 
> I do not understand why it says it is not an Array but the type clearly shows 
> that the constructur is the Array js type.
> 
> 
> 
> I'm fairly new to the language and to clojurescript and I come from js so 
> sorry if I made some stupid mistake.
> 
> 
> 
> After a while I've found a JS workaround to make it work (concat the results 
> to an empty JS array):
> 
> 
> 
>   (println (js->clj (.concat #js[] (.readdirSync fs "resources/photos"))))
> 
>   ;=> [.DS_Store 2013 Aachen Alicante India Maria Londres 2009]
> 
> 
> 
> Any help/advice would be greatly appreciated.
> 
> 
> 
> Thanks!
> 
> Joaquin
> 
> 
> 
> ps: Project conf
> 
>   :dependencies [[org.clojure/clojure "1.5.1"][org.clojure/clojurescript 
> "0.0-2138"]]
> 
>   :plugins [[lein-cljsbuild "1.0.1"] [org.bodil/lein-noderepl "0.1.10"]]
> 
> 
> 
> --
> 
> Note that posts from new members are moderated - please be patient with your 
> first post.
> 
> ---
> 
> You received this message because you are subscribed to the Google Groups 
> "ClojureScript" group.
> 
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> 
> To post to this group, send email to [email protected].
> 
> Visit this group at http://groups.google.com/group/clojurescript.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to