This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-04-15
Channels
- # announcements (3)
- # architecture (1)
- # babashka (52)
- # beginners (228)
- # calva (1)
- # chlorine-clover (31)
- # cider (9)
- # clj-kondo (16)
- # cljs-dev (25)
- # cljsrn (21)
- # clojure (116)
- # clojure-argentina (8)
- # clojure-europe (18)
- # clojure-france (17)
- # clojure-germany (1)
- # clojure-nl (5)
- # clojure-spec (49)
- # clojure-uk (63)
- # clojurescript (59)
- # community-development (14)
- # conjure (89)
- # core-matrix (1)
- # cursive (18)
- # data-science (1)
- # datomic (27)
- # exercism (4)
- # figwheel-main (5)
- # fulcro (38)
- # ghostwheel (8)
- # graalvm (5)
- # hoplon (2)
- # jobs-discuss (17)
- # juxt (1)
- # lambdaisland (5)
- # luminus (1)
- # lumo (9)
- # malli (7)
- # off-topic (32)
- # planck (24)
- # re-frame (14)
- # reagent (14)
- # reitit (14)
- # rum (23)
- # shadow-cljs (80)
- # spacemacs (2)
- # sql (6)
- # unrepl (1)
- # xtdb (2)
same error on attempting to macroexpand
a full macroexpand fails but if I macroexpand-1
I get
(cljs.core/defprotocol MyProtocol (proto-method [b]))
which works fine if I then copy and paste that into my source. very oddI could use a hand with understanding an issue with using cljsjs packages. I've now run the second time into an issue where I would like to use a symbol from the underlying package, but I just get an undefined error when I try.
Concretely: I require ["@date-io/date-fns" :as df]
and then try to use df/DateFnsUtils
, but this is apparently undefined.
I see that there is a var declared but not really defined in https://github.com/cljsjs/packages/blob/master/date-io/resources/cljsjs/date-io/common/date-io.ext.js
@schaueho those are just externs. they are meant to prevent :advanced
compilation from renaming them. the df
is all you need? meaning it should have all the properties you might need?
Sort of ... In the end I want to use a different JS lib, material-ui-pickers (date/time pickers) and this expects to be handed over this DateFnsUtils constructor. I guess it's ultimately calling other functions from date-fns internally.
when I compare the date-io.ext.js contents above with the ones for the material-ui package (which I use without issues), then the latter defines all the various components / functions etc. as properties.
but that of course doesn't help me with understanding what I have to do to use the @date-io/date-fns
package.
I created a small repo that demonstrates this issue: https://clojurians.slack.com/archives/C03S1L9DN/p1586906676023300 https://github.com/mitchdzugan/proto-fail This very simple macro
#?(:clj
(defmacro defprotom [proto-name fn-name fn-args]
`(~(macros/case :clj 'clojure.core/defprotocol
:cljs 'cljs.core/defprotocol) ~proto-name
(~fn-name ~fn-args))))
fails only in clojurescript
running lein test-cljs
will demonstrate the failure. If you comment out the usage of the macro it prints the result of macroexpand-1
the same thing which is strange because if you take that result and put it back in the file the test will pass.
Appreciate any help this has been stumping me for several days now.For some reason this worked
#?(:clj
(defmacro defprotom [proto-name fn-name fn-args]
`(~(macros/case :clj 'clojure.core/defprotocol
:cljs 'cljs.core/defprotocol) ~proto-name
~(clojure.core/list fn-name fn-args))))
not sure why but ill take itanyone has a library to turn sentences like “every 2 weeks” into something useful to do math with? (e.g. would be a seq of dates of today + intervals of two weeks)
Hello, I have a naive question for anyone who would like to answer...https://stackoverflow.com/questions/61235324/difference-between-a-shared-variable-and-a-channel
you could implement your own buffer if you really wanted something that would tell you the current size. you'd be using things inside .impl. ns's though so no guarantee on forward compatibility
but @potetm if a channel is not a buffered channel, then i'ts not really a queue right?
unbuffered channels do have space for a single value, there is no buffer. they require both producer and consumer to show up at the same time to transfer the value directly from one to the other (this is called a "rendezvous" in other systems)
Even unbuffered, they offer pretty much the same semantics. Most importantly, asynchrony.
(defn main-content [] 73 [:div 74 [:p "What we offer"] 75 [:ul (fn [] 76 (doseq [xs (site-content :offerings)] 77 [:li (xs :heading)]))]])
https://clojuredocs.org/clojure.core/doseq > Returns nil.
You are looking for https://clojuredocs.org/clojure.core/for instead
https://reagent-project.github.io/
ctrl+f/cmd+f (for
@U08E8UGF7 so, updated, the code looks like
(defn main-content [] [:div
[:p "What we offer"]
[:ul (for [xs (site-content :offerings)]
(do
[:li (xs :heading)]
[:li (xs :desc)]))]])
and it is only displaying the headingor rather the description
should i be placing those <li>s in a vec?
fragments?? never heard of those, lemme head to google
you, sir, or madame, are a godsend! thank you so much!!
working as expected now!
so, i am trying to build a dynamic <ul> that adds <li>s according to a datastructure that I have in my website
so far, after many many attempts, i still cannot get those <li>s to work
(def site-content {:main-header "Love and Labradorite"
:tagline "Love and Labradorite"
:offerings [{:heading "Tarot Reading ($15 and up)"
:desc "30 minutes and up. Minimum of six cards maximum of 10 on a subject that you require guidance on."}
{:heading "Intuition Reading with Spirit Guidance ($30 and up)"
:desc "Do you need guidance about career, love, or any other topic going on in your life? I can give you a full reading with spirit guidance on how to handle your current situation. This is my custome\
r favorite."}
{:heading "Mediumship ($60 and up)"
:desc "Connect to a passed love ones to receive messages and closure."}
{:heading "Reiki Distance Healing ($25)" :desc "Reiki is non-invasive and is used holistically to restore balance in mind, body and spirit while promoting the body's regenerative self-healing ability. Its healing energy connects us on an ene\ rgetic and spiritual level where the healing work is conducted."}]})
there is the data structure
For some reason this worked
#?(:clj
(defmacro defprotom [proto-name fn-name fn-args]
`(~(macros/case :clj 'clojure.core/defprotocol
:cljs 'cljs.core/defprotocol) ~proto-name
~(clojure.core/list fn-name fn-args))))
not sure why but ill take it