Update: this definitely seems to be something to do with being within the 
go-loop. Hoisting it out into a separate function also fixes the problem:

(defn setx [elem x]
  (set! (.. elem -cx -baseVal -value) x))

(let [circle (dom/getElement "circle")]
  (go-loop [x 20]
    (<! (timeout 10))
    (setx circle x)
    (recur (inc x))))

--
paul.butcher->msgCount++

Silverstone, Brands Hatch, Donington Park...
Who says I have a one track mind?

http://www.paulbutcher.com/
LinkedIn: http://www.linkedin.com/in/paulbutcher
Skype: paulrabutcher




On 12 Jan 2014, at 10:25, Paul Butcher <[email protected]> wrote:

> I'm still finding my feet with ClojureScript, so please forgive any stupid 
> mistakes. I've just hit an oddity when using set! with ..
> 
> I have a page with a very simple SVG on it:
> 
> <svg width="500" height="100">
>   <circle id="circle" cx="20" cy="20" r="10" style="stroke: none; fill: 
> #ff0000;"/>
> </svg>
> 
> And a very simple little piece of ClojureScript that animates it:
> 
> (let [circle (dom/getElement "circle")]
>   (go-loop [x 20]
>     (<! (timeout 10))
>     (set! (.-value (.-baseVal (.-cx circle))) x)
>     (recur (inc x))))
> 
> This all works fine. If, however, I change the set! to:
> 
> (set! (.. circle -cx -baseVal -value) x)
> 
> I get the error:
> 
> Wrong number of args (3) passed to: core$-DOT
> 
> But the same structure works fine outside of the go-loop. So this, for 
> example, compiles and runs exactly as I'd expect:
> 
> (set! (.. (dom/getElement "circle") -cx -baseVal -value) 200)
> 
> I'd be very grateful for any pointers as to what's up.
> 
> Thanks,
> 
> --
> paul.butcher->msgCount++
> 
> Silverstone, Brands Hatch, Donington Park...
> Who says I have a one track mind?
> 
> http://www.paulbutcher.com/
> LinkedIn: http://www.linkedin.com/in/paulbutcher
> Skype: paulrabutcher
> 
> 
> 
> 

-- 
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