On 30/08/2014 15:07, Alexey Kachayev wrote:
for macro expects each pair to be either binding-form/collection-expr or
one of known modifiers (:let, :when, :while).

Here:

plan (keyword (first l))

you give a pair of binding-form and keyword (which is really impossible
to iterate over).

If you meant let-binding for plan, dec, min and long, use :let modifier
(you can find example in documentation -
http://clojuredocs.org/clojure_core/clojure.core/for).


I'm going to have to reduce the resulting list next so I thought to use a map version of the list comp. but ran into a similar error:

 (defn calc .......
     (let [ .....
         .......
         list-of-lists (map #(rest (first %)) results)]
    (-> list-of-lists
        (map #(let [plan (keyword (first %))
                          deg (Integer/parseInt (second %))
                          sign (signs (keyword (first (rest (rest %)))))
                          min (Integer/parseInt (second (rest (rest %))))
                          long (Float/parseFloat (last %))]
                      {plan {:sign sign :deg deg :min min :long long}})))


"Don't know how to create ISeq from: astro.calc$calc$fn__29869"

Now I'm using a let form but the error is similar.

gvim

















2014-08-30 16:47 GMT+03:00 gvim <gvi...@gmail.com
<mailto:gvi...@gmail.com>>:

    I have a long function which produces `list-of-lists` :

    (("Sun" "21" "li" "13" "201.2139410 <tel:201.2139410>")
      ("Moon" "11" "le" "21" "131.3457459")
      ......)

    .... before entering a list comprehension (simplified for brevity):

      (defn calc .......
         (let [ .....
             .......
             list-of-lists (map #(rest (first %)) results)]
             (for [l list-of-lists
                  plan (keyword (first l))
                   deg (Integer/parseInt (second l))
                   sign (signs (keyword (first (rest (rest l)))))
                   min (Integer/parseInt (second (rest (rest l))))
                   long (Float/parseFloat (last l))]
                {:deg deg :min min :long long})))

    When I call the function I get this error:

    IllegalArgumentException Don't know how to create ISeq from:
    clojure.lang.Keyword  clojure.lang.RT.seqFrom (RT.java:505)

    I've tested all the bindings in the repl and they produce the
    desired data so it seems the final construction of the map is where
    the problem lies.

    gvim


    --
    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
    <mailto: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+unsubscribe@__googlegroups.com
    <mailto:clojure%2bunsubscr...@googlegroups.com>
    For more options, visit this group at
    http://groups.google.com/__group/clojure?hl=en
    <http://groups.google.com/group/clojure?hl=en>
    --- You received this message because you are subscribed to the
    Google Groups "Clojure" group.
    To unsubscribe from this group and stop receiving emails from it,
    send an email to clojure+unsubscribe@__googlegroups.com
    <mailto:clojure%2bunsubscr...@googlegroups.com>.
    For more options, visit https://groups.google.com/d/__optout
    <https://groups.google.com/d/optout>.




--
Kind regards,
Alexey S. Kachayev,
CTO at Attendify.com
----------
http://github.com/kachayev
http://twitter.com/kachayev
Skype: kachayev
Tel: +380-996692092

--
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
---
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to clojure+unsubscr...@googlegroups.com
<mailto:clojure+unsubscr...@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout.

--
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
--- You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to