Yeah, I ended up writing two such functions for converting Clojure sequentials into JS arrays and maps into JS objects:
https://gist.github.com/1141054 (Note that they won't convert a vector containing maps or vice versa properly, so they're not quite "nice functions" yet.) On Aug 11, 2:14 pm, Ken Wesson <kwess...@gmail.com> wrote: > On Thu, Aug 11, 2011 at 5:02 PM, Kevin Lynagh <klyn...@gmail.com> wrote: > > Alright, thanks for the info. Do you know why an automatic solution is > > out? > > > I'm trying to use D3 from ClojureScript, but right now all of the > > clarity I get from Clojure's nicer data manipulation abstractions is > > lost having to convert to/from JS objects everywhere. > > At the very least there should be nice functions to call to convert > back and forth explicitly, if automatic conversion is out and a reader > macro will only work for compile time constants. So one could use > @@the-structure for constants, and (to-js the-structure) for anything > else, or something of the sort. Or is such a function already there, > but considered annoying enough to want to be able to hide it in > implicit conversions or short, pithy reader macros? Of course, in the > latter case, a reader macro that expands to the function call could > work on non-constants, though, as @foo already expands to (deref foo) > in normal Clojure and does not require foo to be a compile time > constant. > > -- > Protege: What is this seething mass of parentheses?! > Master: Your father's Lisp REPL. This is the language of a true > hacker. Not as clumsy or random as C++; a language for a more > civilized age. -- 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