This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-05-25
Channels
- # adventofcode (3)
- # aleph (24)
- # architecture (8)
- # beginners (53)
- # boot (34)
- # cider (7)
- # clara (68)
- # cljs-dev (6)
- # cljsrn (3)
- # clojars (10)
- # clojure (71)
- # clojure-germany (2)
- # clojure-italy (10)
- # clojure-nl (25)
- # clojure-serbia (4)
- # clojure-spec (13)
- # clojure-uk (48)
- # clojurescript (31)
- # core-async (62)
- # cursive (13)
- # datomic (4)
- # duct (76)
- # editors (4)
- # fulcro (2)
- # immutant (1)
- # instaparse (1)
- # jobs (1)
- # lein-figwheel (1)
- # mount (1)
- # off-topic (12)
- # onyx (8)
- # re-frame (10)
- # reagent (84)
- # reitit (2)
- # ring (2)
- # shadow-cljs (159)
- # spacemacs (2)
- # specter (17)
- # sql (14)
- # tools-deps (10)
- # yada (15)
I remember that article @arohner, I don't know where it is though. If you want something similar to what he suggested, you could check out mount
@arohner did you mean this one https://medium.com/@maciekszajna/reloaded-workflow-out-of-the-box-be6b5f38ea98?
can I refactor this somehow?
(let [uncategorized {:id :uncategorized
:name "Uncategorized"}
group-fn #(if (-> % :gallery nil?)
uncategorized
(:gallery %))]
(group-by group-fn projects))
(group-by #(get-in % [:gallery] uncategorized) projects)
should work
alternatively #(:gallery % unrecognized-group)
that won’t work, because :gallery
key is there, but the value is nil
. so it doesn’t get to uncategorized-group
part basically
Is there a way to evaluate a symbol while in the current context? So far i've tried (let [x 10] (eval 'x))
which does not recognize the x
@benzap yes it's possible 🙂 https://github.com/TristeFigure/shuriken#lexical-eval
But more directly you just do this: https://clojurians.slack.com/files/U0HJAJ570/FAVKH3H0U/-.clj
@tristefigure thanks, i'll check it out
This is my tote-bag repo where I start development on stuffs that I later extract to their own lib. I'll probably move this in a separate repo this weekend, I'll state it in the README.
(defmacro form-eval
[& body]
(:result
(reduce
(fn [{:keys [result eval-next?]} atom]
(cond
(= atom '%=)
{:result result
:eval-next? true}
eval-next?
{:result (conj result atom)}
:else
{:result (conj result `(quote ~atom))}))
{:result []}
body)))
(let [x 10] (form-eval test value %= x))
This gives the result you desired.What do you prefer for optional merging of maps?
(def errors [:a :b])
(def warnings [])
(def infos [:e :f])
;; 1. merge + 3x when
(merge {}
(when (seq errors) {:errors [:a :b]})
(when (seq warnings) {:warnings [:c :d]})
(when (seq infos) {:infos [:e :f]}))
;;=> {:errors [:a :b], :infos [:e :f]}
;; 2.cond-> + 3x merge
(cond-> {}
(seq errors) (merge {:errors [:a :b]})
(seq warnings) (merge {:warnings [:c :d]})
(seq infos) (merge {:infos [:e :f]}))
;;=> {:errors [:a :b], :infos [:e :f]}
Any other approach?We've got 2 maps, 1 with keys a b c d e, the other with keys d e f g. You want a single end map with keys a b c from the first and d e f g from the second. Why would you not merge? Assoc would require you to add each key individually
Hi everyone, I use the "checkouts" directory feature with leiningen when I want to use a project on my local machine as a dependency for a project. What is the appropriate way to do something similar with the new clojure CLI tools and deps.edn
file? Thanks in advance for any tips!
one note is that local deps must use a manifest definition in either deps.edn or pom.xml (project.clj not supported right now)
nrepl has a server namespace for starting a repl from inside a running application. Don't listen to anything but local connections (listening for outside connections is a huge security issue, if you need to access it from another host use an ssh tunnel to make a local connection)
if you only need it during dev, you can start your spring app main from inside a repl in a bacground thread
hosting nrepl inside an app is simple: https://github.com/clojure/tools.nrepl#embedding-nrepl-starting-a-server
not sure if this is the right place to ask but Im having issues on how to deploy my lib to clojars (this is my first lib in clojure so sorry if im missing something obvious) Ive generated my gpg key, but Im not sure on how associate it with my clojars account
Maybe this will help? https://clojure.org/reference/java_interop
In general, if you want to call method foo
of an object of class Bar
, then (def x (Bar. ...))
and then (.foo x)
Great. The details are at the link I provided earlier. Maybe try again in the morning 🙂
hello everyone, I was searching for a macro that leverages pattern matching, and worked like Elixir`s with
I’ve managed to get a working version, but this is my first macro, so any feedback is appreciated
https://github.com/pablobcb/clj-with
I hope the README is self explanatory