This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-12-31
Channels
- # beginners (57)
- # boot (25)
- # cider (86)
- # cljs-dev (6)
- # clojure (137)
- # clojure-russia (7)
- # clojure-spec (10)
- # clojure-turkiye (1)
- # clojure-uk (47)
- # clojurescript (37)
- # cursive (10)
- # datascript (2)
- # datomic (2)
- # dirac (59)
- # emacs (1)
- # hoplon (46)
- # instaparse (122)
- # om (32)
- # om-next (1)
- # onyx (3)
- # pedestal (2)
- # perun (4)
- # protorepl (6)
- # re-frame (15)
- # reagent (60)
- # rum (4)
- # specter (7)
- # sql (3)
- # untangled (3)
- # yada (4)
Not sure if there’s a kindle version available but I think it might be written with a system that allows mobi export
The reason for the impl
is that otherwise a cljs.spec.gen
namespace would collide with the cljs.spec/gen
var.
@udhan It has to do with the way the code is transpiled to JavaScript. A concrete example in your case is
(= js/cljs.spec.gen cljs.spec/gen cljs.spec.gen)
evaluates to true
and if you look at the generated JavaScript, you get
cljs.core._EQ_.call(null,cljs.spec.gen,cljs.spec.gen,cljs.spec.gen)
So, in short you can see how namespaces and vars are implemented in the JavaScript.You will trigger a helpful compiler diagnostic if you accidentally go down that path yourself:
cljs.user=> (ns foo.bar)
nil
foo.bar=> (def baz 3)
#'foo.bar/baz
foo.bar=> (ns foo.bar.baz)
WARNING: Namespace foo.bar.baz clashes with var foo.bar/baz at line 1
nil
Guys I have ubuntu 14.04 with clean install. I just follow these instructions: https://gadfly361.github.io/gadfly-blog/2016-11-13-clean-install-of-ubuntu-to-re-natal.html When i enter the init command: re-natal init blabla; here is the output: ------
Creating blabla ☕ Grab a coffee! Downloading deps might take a while... Creating Leiningen project Updating Leiningen project Creating React Native skeleton. Command failed: node -e "require('react-native/local-cli/cli').init('.', 'blabla')" ------------- Sorry for interrupted message and my bad english. I need your help, I don't get the point.
maybe you need to install node?
try node --version
also, #cljsrn may be a better place to ask
node --version command is giving me "v4.7.0" answer. I follow the instructions with no errors.
Guys: following code is fix my problem: sudo npm i --save-dev invarian I am sorry for early asking.
Is there a proper way of reading a string with multiple forms (so that (multiple-read-string "1 2 3")
would give me [1 2 3]
and not just 1
) or is a (str \[ the-forms \]
the way to go?
you can do something with streams and calling read multiple times I think; I always do (str "[\n" the-forms "\n]")
just to be paranoid about ;;
if you want to figure it out I'd check what kind of thing read
expects
Thanks for the help @gfredericks
In cljs 1.9.293, it looks like there's no generator defined for boolean? by default. at the repl, if I try (s/gen boolean?), I get "unable to construct gen for function cljs$core$boolean?" - is this intentional?
Looking at the docstring for s/gen, it looks like I can supply an overrides map that would include a simple generator of booleans as a workaround, but I haven't found the right way to supply it -
e.g. (s/gen boolean? {:cljs.core/boolean? clojure.test.check.generators/boolean})
doesn't work.
I must be making some kind of mistake - it looks like boolean? does have a generator implemented. https://github.com/clojure/clojurescript/commit/2a7454837244cf7de3dfed1e48f46f86c33a1809
alright this works with the bare cljs quick start jar, I must be screwing up deps somewhere.
even weirder, the stack trace for (s/gen boolean?)
has 1.9.293 all over it:
Prompt will show when Figwheel connects to your application
To quit, type: :cljs/quit
cljs.user=> (require '[clojure.spec :as s])
nil
cljs.user=> (require 'clojure.test.check.generators)
nil
cljs.user=> (s/gen boolean?)
#object[Error Error: Unable to construct gen at: [] for: function cljs$core$boolean_QMARK_(x){
return (x === true) || (x === false);
}]
cljs$spec$gensub (jar:file:/Users/bert/.m2/repository/org/clojure/clojurescript/1.9.293/clojurescript-1.9.293.jar!/cljs/spec.cljs:236:5)
cljs$core$IFn$_invoke$arity$2 (jar:file:/Users/bert/.m2/repository/org/clojure/clojurescript/1.9.293/clojurescript-1.9.293.jar!/cljs/spec.cljs:872:29)
cljs$spec$gen (jar:file:/Users/bert/.m2/repository/org/clojure/clojurescript/1.9.293/clojurescript-1.9.293.jar!/cljs/spec.cljs:858:51)
cljs$core$IFn$_invoke$arity$1 (jar:file:/Users/bert/.m2/repository/org/clojure/clojurescript/1.9.293/clojurescript-1.9.293.jar!/cljs/spec.cljs:868:26)
cljs$spec$gen (jar:file:/Users/bert/.m2/repository/org/clojure/clojurescript/1.9.293/clojurescript-1.9.293.jar!/cljs/spec.cljs:854:51)
nil
I have a series of questions about reagent best practices, but I am having trouble formulating my thoughts into a stack overflow question that wont have only subjective answers. If any of you kind soul finds the time, could I have what I am writing in this toy project --torn apart-- code reviewed? https://github.com/bowbahdoe/test-clj/blob/master/src/cljs/site/components/navbar.cljs Specifically, I am wondering about stuff like the signature for navbar; should I do it like I am with [title & descs] or should I do [props & children] and have the data contained in props. Is it okay for me to just give keys based on the index if the data doesn't change? Is it okay for me to make that assumption or am I just introducing bugs down the line? Is the mutual recursion introduced by how I structured the data acceptable, or is there a good way to avoid that performance hit in this case? trampoline? In what ways is my code bad and in what ways should I feel bad?