This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-04-19
Channels
- # announcements (3)
- # babashka (42)
- # beginners (84)
- # calva (3)
- # cider (13)
- # clj-kondo (9)
- # cljs-dev (6)
- # cljsrn (32)
- # clojure (47)
- # clojure-argentina (4)
- # clojure-france (2)
- # clojure-spec (17)
- # clojure-uk (15)
- # clojuredesign-podcast (4)
- # clojurescript (41)
- # conjure (53)
- # cursive (16)
- # data-science (5)
- # duct (1)
- # emacs (11)
- # events (1)
- # exercism (3)
- # fulcro (48)
- # graalvm (20)
- # graphql (1)
- # joker (3)
- # kaocha (2)
- # malli (2)
- # meander (6)
- # pathom (3)
- # planck (18)
- # rdf (3)
- # re-frame (14)
- # ring-swagger (1)
- # shadow-cljs (15)
- # specter (1)
Are persistent datastructures always included, even in advanced mode?
(js/console "hello, world")
should just translate to console.log("hello, world")
I know hello-world size is not the thing that matters for real apps. I was just curious what the 95K (pre gzip) bundle contains.
@jaihindhreddy some code in cljs.core
prevents removal of more code but this is fixed in current cljs master
so will be fixed in next release. but yes any real world app will have all that code anyways.
(def current-state (atom :start))
but then,
(get other-atom current-state)
does not work, saying Uncaught Invariant Violation: Objects are not valid as a React child o.o
i'm trying to store the atom value as a keyword, to then do a lookup in another atom. am i doing it incorrectly?
(deref'd of course!)
how would you implement a state machine in clojurescript using one atom for states and the other for current-state?
that's my goal right now đ
see the readme: https://github.com/metosin/tilakone
Thanks!
I still don't know the edges where clojurescript != clojure. I expect a keyword to be a keyword to be a keyword, but apparently it becomes something else along the way
Your code is wrong in some other place. The âObject is not a React elementâ error means youâre passing something to React that isnât a react element.
that is useful, but also overkill for what i'm doing đ
hmm, maybe keywords are just not good to use in CLJS?
what do you mean you expect a keyword to be a keyword but it becomes something else? what is "the way" here?
@sova I've never run into any issues with keywords with cljs and I expect that they are quite heavily used by all clojurescript users just as they are in Clojure
Iâm trying to exactly understand using macros in ClojureScript. I know that macros are written and evaluated in Clojure, but I canât wrap my how eval
works in macros called from ClojureScript.
Letâs say I have this code:
(ns app.macro.clj)
(defmacro defthing [name thing]
`(def ~name ~(eval thing)))
(ns app.core.cljs
(:require-macros [app.macro.clj :refer [defthing]]))
(defthing hello (str "hello" " world!"))
This will not work because compiler is Unable to resolve symbol: str in this context
. What bindings are available for eval
run in macro called in ClojureScript file? Are there any?
I hope my question is understendableI know that prefixing might help but I still donât understand why it happens. str
exists in clojure.core
and in cljs.core
so why canât eval
access it?
@dpsutton thanks i will try and show an example
the clojurescript interop page says don't expect identical? to work on keywords, but that's not exactly the problem i was having
For example,
(def t-current-state (atom :start))
(def t-all-states (atom {:start [:noun :verb]
:noun [:verb :particle :nona :da]
:verb [:noun :accept]
:particle [:noun :verb]
:nona :noun
:da :accept}))
(.log js/console "test: " (get @t-all-states @t-current-state))
is there some way I can have it spit out a clean [:noun :verb]
result?Is there something specific to read browser cookies or I should use js interop directly?
I tried to google this but all I get is reagent and ring and similar very specific examples (I use neither)
tbh you could probably just copy https://github.com/reagent-project/reagent-utils/blob/master/src/reagent/cookies.cljs into your project, it's not dependent on reagent at all
That's a pretty thin wrapper around https://google.github.io/closure-library/api/goog.net.Cookies.html
Hello, I've started using cljs (with shadow-cljs, don't know if that is important), but when I try to do something like (keys nil)
, I get an error, though I'd be expecting a similar behaviour to clj (which simply returns nil). Why is that?
What's the error?
Performing (keys nil)
returns nil
on
https://clojurescript.io/
sorry, I am no longer getting that :thinking_face: