This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-02-21
Channels
- # admin-announcements (3)
- # beginners (15)
- # boot (96)
- # cider (5)
- # cljsjs (2)
- # cljsrn (3)
- # clojure (22)
- # clojure-austin (2)
- # clojure-russia (16)
- # clojured (2)
- # clojurescript (65)
- # css (4)
- # cursive (89)
- # datomic (7)
- # emacs (89)
- # events (1)
- # hoplon (126)
- # leiningen (2)
- # off-topic (2)
- # om (268)
- # onyx (19)
- # parinfer (42)
- # re-frame (5)
- # reagent (30)
- # yada (8)
Hi all. I'm trying to draw a polygon on a map using CLJS but I have an issue with this piece of code.
You can see a JS working example here: https://www.mapbox.com/mapbox.js/example/v1.0.0/show-polygon-area/
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
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 https://github.com/rplevy/swiss-arrows
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 errorany ideas?
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!