This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-11-01
Channels
- # aleph (1)
- # bangalore-clj (5)
- # beginners (24)
- # boot (113)
- # cider (42)
- # cljs-dev (2)
- # cljsjs (2)
- # cljsrn (3)
- # clojure (37)
- # clojure-austin (4)
- # clojure-brasil (3)
- # clojure-france (55)
- # clojure-greece (15)
- # clojure-ireland (4)
- # clojure-italy (13)
- # clojure-russia (37)
- # clojure-spec (50)
- # clojure-uk (31)
- # clojurescript (49)
- # component (12)
- # consulting (1)
- # cursive (6)
- # datascript (9)
- # datomic (27)
- # editors (2)
- # garden (1)
- # hoplon (18)
- # jobs (1)
- # klipse (25)
- # lein-figwheel (1)
- # leiningen (1)
- # luminus (2)
- # om (53)
- # om-next (8)
- # onyx (5)
- # parinfer (4)
- # perun (4)
- # re-frame (13)
- # remote-jobs (1)
- # ring (1)
- # ring-swagger (3)
- # rum (52)
- # spacemacs (36)
- # specter (13)
- # sql (3)
- # untangled (49)
- # vim (11)
- # yada (9)
Hey y’all. Can someone copy and paste their project.clj file that’s in their .lein directory? I think I broke mine on accident and ended up breaking all of my Lein. 😩
Do you mean profiles.clj
?
Mine just has
{:user {:plugins [[lein-ancient "0.6.7"]
[lein-localrepo "0.5.3"]
[lein-try “0.4.1”]]}}
Oops yeah that’s what I meant. Is that the newest version of profiles.clj?
How does one pattern match a map whose key is arbitrary? for example, I got a data structure, about which I know that it's gonna be a map with only one key-value pair, and its value will be a vector. How do I match it?
requires fiddling, but does the trick, thanks! @dominicm Would be really nice to destructure the maps without knowing directly their exact keys, though. I found myself needing this feature pretty often
@vandr0iy Well, a hashmap
, is a sequence of MapEntry
, which you can think of as looking like this:
[
[k v]
[:foo :bar]
]
I'm not sure how destructuring without knowing the key would look. Unless you're talking about core.match
(match [{:foo ["bar" "baz"]}]
[k :guard keyword?] (println "it's a keyword: " k)
[{k vals}] (println "key:" k "vals:" vals))
something like this@vandr0iy core.match supports guards similar to that: https://github.com/clojure/core.match/wiki/Basic-usage#guards
although if you want to traverse the structure recursively you’ll need to combine it with specter, clojure.walk, or some kind of manual recursion
if you know how deep the map is going to be, you can match on a pattern like [{(k :guard keyword?) v}] …