First the builder function is not quite right, it needs to return the result:

(fn [arr x] (.push arr x) arr)

But even so this will not work because this function doesn't implement
the result arity of transducer fns. What you actually need is:

(completing (fn [arr x] (.push arr x) arr))


On Sat, Dec 13, 2014 at 11:15 AM, Paul Cowan <[email protected]> wrote:
> I was playing around with transducers that recently dropped in clojurescript.
>
> I started off with this which works as I expect
>
> (transduce (filter #(not (.hasOwnProperty prevChildMapping %))) conj [] 
> nextKeys)
>
> This returns a PersistentVector which is not what I require because I am 
> working in react so I tried the following code:
>
> (transduce (filter #(not (.hasOwnProperty prevChildMapping %))) (.-push 
> #js[]) #js [] nextKeys)
>
> This returns the following error:
>
> Uncaught TypeError: Array.prototype.push called on null or undefined
>
> Could this be a bug or am I missing some other interop that is required to 
> work with native objects?
>
>
>
> --
> 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