Fork me on GitHub

Hi all. I'm trying to draw a polygon on a map using CLJS but I have an issue with this piece of code.


Hi all… is there a macro that exists that is similar to the imaginary <- macro I’ve invoked below, or an easy way to write one, or a more idiomatic way of accomplishing the same thing?


@lgastako: I think Prismatic did something like this in their Plumbing library


awesome, thanks.


That <- looks pretty cool. Without it, another couple ways are to use a fn

(->> [{:id 1 :data :x} {:id 2 :data :y}]
  (map (juxt :id identity))
  (into {})
  (#(get % 1)))
or to reach for the “big gun” as->:
(as-> [{:id 1 :data :x} {:id 2 :data :y}] x
  (map (juxt :id identity) x)
  (into {} x)
  (get x 1))


@lgastako: there's also the swiss-arrows lib, which has various generalizations & variations on the threading macros. The Trystero Furcula! The Parallel Diamond Fishing Rod! Fun stuff simple_smile


hello peeps, I’m writing a function that given a list of elements returns a new one with the same elements in reverse order


(defn recursive-reverse [coll]
  (loop [last-index (dec (count coll)) array (list)]
    (if (zero? last-index)
      (conj array (nth coll last-index))
    (recur (dec last-index) (conj array (nth coll last-index)))
is my code so far, but I’m getting ArityException Wrong number of args (0) passed to: PersistentVector but I can’t really tell where I’m making that error


nvm got it sorted…gotta remember the difference between conj a list vs a vector


thanks @eggsyntax and @mfikes for the additional tips


@mfikes: I haven't said thanks yet, so, thanks for helping me figure out the name-mangling issues with advanced compilation. I ended up using aget and changing the map to a vector since the indexes don't get mangled. Thanks!