This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-01-13
Channels
- # announcements (2)
- # beginners (29)
- # boot (122)
- # cider (9)
- # clara (6)
- # cljs-dev (9)
- # clojure (27)
- # clojure-art (3)
- # clojure-dusseldorf (5)
- # clojure-europe (1)
- # clojure-india (2)
- # clojure-losangeles (1)
- # clojure-spec (29)
- # clojure-uk (2)
- # clojurescript (56)
- # cursive (11)
- # datomic (9)
- # fulcro (8)
- # liberator (1)
- # off-topic (2)
- # other-lisps (1)
- # quil (37)
- # re-frame (2)
- # reitit (1)
- # ring (4)
- # test-check (4)
- # tools-deps (3)
@peter.kehl Not sure what you're asking -- lots of macros out there inject def
into the namespace in which they are invoked.
deftest
in clojure.test
, for example. Even defmacro
itself injects a def
.
Thanks @seancorfield. In my macro, I was generating code that used clojure.core/def
instead of def
. I didn't know that special forms are namespace-less.
After all, they are special.
Sorry, the semantics are values
. I did not add the full structure:
{:column-name {1 5 55 68 8 47}}
Example: when column-name
has a value of 1
update it to 5
and so onso you could define a multi-method that dispatches to discern which row type you have and then from there, return a map of values you want to update:
(defmulti update-map (fn [row] <discern row type>))
(defmethod update-map :type-one
[_]
{:column-name {1 5 55 68 8 47}})
if you need something more dynamic, like youâre programmatically creating these update maps, then you could use something like:
(defn update-map [row updaters]
(let [row-type <discern row-type>]
(get updates row-type)))
(update-map row {:type-one {:column-name {1 5 55 68 8 47}}})
Hi team.
Can a macro somehow detect whether the user's namespace has def
-ined a variable with a given name? (Something like &env
, but for def
?)
I'll try with ns-resolve
.
"State of Clojure 2019" survey (https://www.surveymonkey.com/r/clojure2019) has a #19 question: "Rate the priority of making improvements to Clojure in these areas." > "AOT". What does AOT mean?
recursion is still a hard concept for me to grasp sometimes. I try and write out the steps on paper but sometimes it gets a little crazy. is there a way for the repl to step through the function for me? Is that what debugging is? I think I remember Racket had something like that in their DrRacket IDE and it was helpful.
Cursive has the ability to step through code step by step.
That said, as cheesy as it sounds, you have to believe in recursion. âIf I do this now, and recur, and end then, I have my problem solvedâ.
I would recommend just looking at some recursive algorithms, fibonacci comes to mind and quicksort/mergesort
Its just something that clicks eventually, so to say
That actually makes sense to me. I was prompted to ask when I realized I knew what a 4clojure recursion exercise was going to return but had difficulty doing the step by step of it after the fact.
I'm using Cider and apparently it does have the capability if I do want to explore it. Thanks for the chat
Hi team.
Is metadata supposed/planned to work with symbols? https://clojure.org/reference/reader#_metadata says so. However, while the following doesn't fail, it doesn't carry any meta either:
(meta ^:hello 'a) ;=> nil
(with-meta 'a {:hello true})
will do what you want, because it adds metadata after evaluation, so the quote is stripped
@hiredman Wow. Thank you.