This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-08-30
Channels
- # aleph (15)
- # announcements (4)
- # aws (2)
- # bangalore-clj (7)
- # beginners (236)
- # calva (24)
- # cider (11)
- # cljs-dev (63)
- # clojure (141)
- # clojure-europe (3)
- # clojure-india (2)
- # clojure-italy (8)
- # clojure-nl (3)
- # clojure-spec (8)
- # clojure-uk (52)
- # clojured (1)
- # clojuredesign-podcast (4)
- # clojurescript (35)
- # clojutre (3)
- # community-development (1)
- # cursive (77)
- # data-science (1)
- # datomic (3)
- # emacs (13)
- # fulcro (7)
- # graalvm (78)
- # graphql (2)
- # nrepl (7)
- # off-topic (18)
- # pathom (25)
- # reagent (12)
- # reitit (31)
- # shadow-cljs (178)
- # spacemacs (7)
- # tools-deps (32)
- # xtdb (10)
- # yada (3)
I use Cordova as part of my day job, which incidentally does not involve clojure. Did you have specific questions?
I'm looking into extending protocols with metadata. Is it possible to provide an implementation of a protocol for maps in general, and override the implementation for specific maps? I seem to always get the general map behavior
(defprotocol ExtMetaProtocol
:extend-via-metadata true
(ext-meta-protocol [x]))
(ext-meta-protocol (with-meta {} {`ext-meta-protocol (fn [_] 1)})) ;;=> 1
(extend-type cljs.core/PersistentArrayMap
ExtMetaProtocol
(ext-meta-protocol [m]
2))
(ext-meta-protocol {}) ;;=> 2
(ext-meta-protocol (with-meta {} {`ext-meta-protocol2 (fn [_] 1)})) ;;=> 2, wanted 1
but this is probably not working due to the implementation in CLJS. it directly dispatches on the type and doesn't check the meta
it now redirects to http://id.atlassian.com where my old account does not work
the clojurescript website links to jira, but does not explain how I gain access so I can report issues
I seem to get the same behavior even if I define the protocol for a more generic type - e.g. object
Hi I'm struggling with using a content editable p
. I am using this p
because I want to style the text as I write it. I must take care of where the caret is, but at the moment for some reason the last space keeps getting erased and I'm starting to be lost
https://pastebin.com/Cu4SVibs this is the code I am using to move the caret around
Ok I think it's the keyup/keypress/keydown event messing things up nevermind I don't get it
Hi All - I have a question about the implementation of LazySeq, actually several questions, but I'll stick with the main one first:
Since the lazy-seq macro expands into a LazySeq deftype (which wraps the body in a thunk) at macro-expand time, it is not until runtime afaict when first
or rest
is called on the LazySeq that the the body is evaluated. However, when it is evaluated, the recursive nature of the body results in another call to lazy-seq, but this is after compile / macro-expansion time, right? How does that work?
I do not know the answer, but just an FYI that #cljs-dev may reach an audience with more people who know the answer.
this is an interesting question. my understanding is that macro expansion can occur at runtime as well, but in order for this to happen you need to have the compiler available at runtime. so, for example if you do AOT compilation, I'm pretty sure you can't "call" macros at runtime, so you need to have everything expanded. a macro is actually not very different from a function. the only difference is that it is applied to the data structure representing its body, instead of the arguments (which need to be evaluated before).
so when evaluating a function call (which is a list), clojure looks at the first element. if its a macro it calls it on the rest of the elements (without evaluating them) to obtain another data structure. if this other data structure is also a list it repeats the process, until the first element is not a macro anymore, in which case it must be a function, so it does the function call, which means it evaluates all other elements first, then calls the function. if the evaluation of one of the other elements is a macro expansion it does it, and so on.
on the other side, you don't need macros to implement lazy-seq, they just make the API prettier
You don't need macros to do anything in Clojure or ClojureScript. You can write the macroexpanded version yourself if you prefer. But the macros are often very nice for writing shorter cleaner-looking code.
In Clojure/Java, I suppose you could cause macroexpansion to happen at runtime using eval
, but I do not believe that is possible in ClojureScript, i.e. neither possible to cause macros to be invoked at runtime, nor to call eval
at runtime.