map is lazy so your console log is never done.

use (doall ...)

Dave




On Thursday, 24 January 2013 12:38:37 UTC+11, Ari wrote:
>
> Hi,
>
> The following clojurescript code is *supposed* to identify all anchor tags 
> and print them (originally, I was trying to attach listeners and 
> callbacks); unfortunately, I can't get it to work. Confusingly, there are 
> no compilation or runtime errors. Anyone see what could be wrong? Thanks. 
>
> Note: Code uses jayq 2.0.0 & lein-cljsbuild 0.2.10
>
> --CLJS--
>
> (ns myapp.example
> (:use [jayq.core :only [$]])
> (:use-macros [jayq.macros :only [ready]]))
>
> (def links ($ :a))
>
> (defn listen-to
>   [links]
>   (map 
>     (fn [link] (.log js/console link) links)))
>
> (ready (listen-to links))
>
> --HTML--
>
> <!DOCTYPE html>
> <html>
> <head>
> <script type="text/javascript" src="..."></script>
> </head>
> <body>
> <ul>
> <li><a href="#first">First</a></li>
> <li><a href="#second">Second</a></li>
> <li><a href="#third">Third</a></li>
> </ul>
> </body>
> </html>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Reply via email to