This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-05-27
Channels
- # aleph (1)
- # beginners (48)
- # cider (34)
- # clojure (27)
- # clojure-dev (15)
- # clojure-uk (21)
- # clojurescript (27)
- # data-science (3)
- # datomic (10)
- # instaparse (30)
- # lumo (85)
- # off-topic (3)
- # perun (2)
- # portkey (24)
- # re-frame (13)
- # reagent (17)
- # ring (1)
- # shadow-cljs (77)
- # spacemacs (1)
- # test-check (3)
- # yada (4)
Hey everyone! Courtesy of our open bounty system at Status, we have built a pretty cool new clj-rn library and need a little bit of help building out the other, nicer-to-have parts. So, if you'd like to lend a hand (and earn some cryptocurrency while you're at it, though this is likely not the major motivation for folks around here), please take a look: https://github.com/status-im/clj-rn/issues
@andy489 That seems more appropriate for either #clojurescript or #react-native ... and feels a bit spammy to me /admin (I'm not well-disposed to cryptocurrency folks, so I may just be overly sensitive)
Or #jobs since you're paying people to do work...
(defn get-fn-reference
[kw]
(let [kns (namespace kw)
snm (symbol (name kw))]
(some-> kns
symbol
find-ns
(ns-resolve snm)
deref)))
(defmacro x
[body]
(let [a# (get-fn-reference body)]
`(quote ~a#)))
(= (x clojure.core/not=)
(get-fn-reference 'clojure.core/not=))
I'm struggling to understand why these are not equivalent. It's as if a new not=
object is created at read-time.
The fn
version consistently returns the same hex code, whereas the macro variant returns a new version each time.(defmacro x
[body]
`~(get-fn-reference body))
Even shorter version of x
which exhibits the same behaviour.It's each time a new instance of the class clojure.core$not_EQ_
add class
just under deref
and you will get the desired behavior
not sure it this resolves you broader problem
@tristefigure Why does (get-fn-reference 'clojure.core/not=)
always return the same value?
Notice how the value change when you restart the repl
Notice how (defn fx [] (x clojure.core/not=))
called multipled time return the same value
This is because the macro is expanded only once in this case, when the fn is defined, whereas in your test the macro is expanded each time
not sure why symbols are bound to a new instance of the fn classes though
Maybe try your luck on #clojure-dev, I don't know Clojure's internals well enough
anyone familiar with compojure-api and schema validation can help with a request validation problem?
@jgh While Hiccup is great for producing HTML-as-data and then rendering it, it can be hard for designers etc to work with. We've adopted Selmer for that reason: it can use "plain" HTML templates with {{value}}
substitutions and {% if ... %}
conditionals etc /cc @skrat
We have page fragment templates in our database (a CMS) and our non-programmer staff can edit them easily -- including our translators (we render pages in over a dozen languages).
We use Hiccup where no designers/translators are going to touch the HTML. And we use Hiccup for XML generation too.