Fork me on GitHub
#re-frame
<
2018-03-04
>
deg16:03:02

@tkircsi In the snippet you pasted here, you've commented out the entire body of the for. The for macro requires that its body not be empty.

tkircsi16:03:51

@deg Thx. I’ll check it.

tkircsi16:03:09

I got the previous error message. “Compiling ClojureScript... • js/app.js src/refwf/core.cljs [line 38, col 18] Wrong number of args (3) passed to: core/for Elapsed time: 19.659 sec”

tkircsi16:03:57

putting everything inside the for into ‘do’ it seems it works, but nothing is rendered.

tkircsi16:03:44

putting everything into one line inside the for w/o ‘do’ the same args(3) error

deg18:03:12

Can you post what you are trying to do? The body of the for is just one expression that returns a value. (see https://clojuredocs.org/clojure.core/for) You can use a do to wrap multiple expressions, but only the value of the last will be returned. The others are only for side-effect (and unusual to have, except maybe for "printf debugging"). If you need all the results, you probably need to wrap them into some structure. Most likely, you want to move your [:div ...] inside the for.

tkircsi19:03:24

Hi deg! Sorry, but my notebook’s battery is down. I try to response from my mobile. What I’d trying to do is list the loanlist items like in re-frame todomvc example “ (for [todo visible-todos] ^{:key (:id todo)} [todo-item todo])]])) “ For simplicity I did not do a separate component, but I think, this can be the problem as you wrote. I’d have to put the 2 labels into a div in my code. unfortunately I can’t check it now.

deg20:03:00

Yes. If I understand correctly what you are trying to do, you want something like

(fn []
  (for [loan ll]
    [:div
     [:label (:id loan)]
     [:label (:bank loan)]]))
Also, take a careful look at the documentation for for that I cited above.