clone-for destructuring

53 views
Skip to first unread message

Toni Tuominen

unread,
Oct 19, 2012, 5:37:13 AM10/19/12
to enf...@googlegroups.com
Hey,

I'd like to ask if clone-for is supposed to support destructing in enfocus like it does in enlive? Did not work for me at least, crashed the cljs compiler when I tried.

- Toni

ckirkendall

unread,
Oct 19, 2012, 2:44:08 PM10/19/12
to enf...@googlegroups.com
It is meant to be as close to enlive as possible so I would view this as a bug.  Can you post snippet of what you are trying to do and I will open a ticket.

CK

Toni Tuominen

unread,
Oct 21, 2012, 3:37:43 AM10/21/12
to enf...@googlegroups.com
(em/defsnippet template "/templates/components/calendar.html" "#calendar"
  [entries]
  ["tr.week"] (em/clone-for [week entries]
            ["td"] (em/clone-for [[date entry] week]
                      (em/do->
                        (em/add-class (get entry :type "no-entry"))
                        (em/content (date/format "d" date))
                        (em/listen :click #(state/set! :calendar/current-date (first info)))))))

Trying to compile that throws this error:

Compiling "resources/public/js/main.js" failed.
Exception in thread "main" java.lang.IndexOutOfBoundsException
at clojure.lang.RT.nthFrom(RT.java:784)
at clojure.lang.RT.nth(RT.java:753)
at clj_stacktrace.utils$quartile1.invoke(utils.clj:52)
at clj_stacktrace.utils$fence.invoke(utils.clj:69)
at clj_stacktrace.repl$find_source_width.invoke(repl.clj:98)
at clj_stacktrace.repl$pst_on.invoke(repl.clj:107)
at clj_stacktrace.repl$pst_PLUS_.doInvoke(repl.clj:129)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at cljsbuild.compiler$compile_cljs.invoke(compiler.clj:56)
at cljsbuild.compiler$run_compiler.invoke(compiler.clj:120)
at user$eval1906$iter__1909__1913$fn__1914.invoke(NO_SOURCE_FILE:1)
at clojure.lang.LazySeq.sval(LazySeq.java:42)
at clojure.lang.LazySeq.seq(LazySeq.java:60)
at clojure.lang.RT.seq(RT.java:473)
at clojure.core$seq.invoke(core.clj:133)
at clojure.core$dorun.invoke(core.clj:2725)
at clojure.core$doall.invoke(core.clj:2741)
at user$eval1906.invoke(NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:6511)
at clojure.lang.Compiler.eval(Compiler.java:6501)
at clojure.lang.Compiler.eval(Compiler.java:6501)
at clojure.lang.Compiler.eval(Compiler.java:6477)
at clojure.core$eval.invoke(core.clj:2797)
at clojure.main$eval_opt.invoke(main.clj:297)
at clojure.main$initialize.invoke(main.clj:316)
at clojure.main$null_opt.invoke(main.clj:349)
at clojure.main$main.doInvoke(main.clj:427)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:419)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.Var.applyTo(Var.java:532)
at clojure.main.main(main.java:37)

ckirkendall

unread,
Oct 21, 2012, 9:42:36 PM10/21/12
to enf...@googlegroups.com
I have  pushed a fix up.  Would you mind testing it out by switching your dependencies over to 1.0.0-SNAPSHOT.

CK


Reply all
Reply to author
Forward
0 new messages