This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-07-04
Channels
- # announcements (5)
- # beginners (56)
- # calva (2)
- # cider (30)
- # circleci (2)
- # cljsrn (90)
- # clojars (3)
- # clojure (18)
- # clojure-dev (9)
- # clojure-europe (3)
- # clojure-greece (14)
- # clojure-ireland (6)
- # clojure-italy (6)
- # clojure-nl (7)
- # clojure-norway (1)
- # clojure-spec (1)
- # clojure-sweden (3)
- # clojure-uk (14)
- # clojurescript (52)
- # cursive (5)
- # data-science (9)
- # datomic (3)
- # emacs (26)
- # expound (11)
- # figwheel (3)
- # figwheel-main (6)
- # fulcro (24)
- # garden (1)
- # graalvm (101)
- # liberator (1)
- # mount (1)
- # off-topic (1)
- # pathom (27)
- # portland-or (2)
- # reagent (13)
- # reitit (2)
- # ring (1)
- # shadow-cljs (10)
- # spacemacs (11)
- # sql (6)
@dnolen could you advise me how to report clojurescript bugs like that?
cljs.user=> (for [x [1]] :a :b)
(:a)
That works for me
cljs.user> (for [x [1]] :a)
(:a)
cljs.user> (for [x [1]] :a :b)
Unexpected error (ArityException) compiling at (<cljs repl>:1:1).
Wrong number of args (3) passed to: cljs.core/for
I'm using [org.clojure/clojurescript "1.10.520"]Im using emacs + cider 0.21 and this is what it adds to my project.clj environment when it jacks in
I have cider autostart figwheel. and those versions are: :plugins -> [lein-figwheel "0.5.19"] :dependencies -> [figwheel-sidecar "0.5.19"]
so to clarify, those figwheel deps are in my project.clj for any environment, and when I jack-in from cider, it adds the ones above (cider + nrepl)
so just tested without cider. Have just the two figwheels in the project:
Prompt will show when Figwheel connects to your application
[Rebel readline] Type :repl/help for online help info
ClojureScript 1.10.520
dev:cljs.user=> (for [x [1]] :a :b)
---- Could not Analyze <cljs form> line:1 column:1 ----
Wrong number of args (3) passed to: cljs.core/for
1 (for [x [1]] :a :b)
^---
---- Analysis Error ----
there is a problem - <mailto:[email protected]|[email protected]> doesn't have access to http://clojure.atlassian.net when I press "Request access" button I got 404: Oops, you've found a dead link.
If you don’t have a jira, file it in the support portal
No acct needed. I’ll move it to the right place from there
Hello everyone!
I’m trying to call in Phaser
(https://github.com/photonstorm/phaser#changelog) in a ClojureScript
project here (https://github.com/abhi18av/rum-tavern). I’ve tried the npm-deps
as well as cljsjs
version of phaser but it seems there are problems while importing the phaser
library.
I am trying out this snippet in the associated cljs
repl
(ns rum-tavern.phaser
(:require [phaser :refer (Phaser)]))
And here’s the output
#object[Error Error: Assert failed: No more than 1024 pending puts are allowed on a single channel. Consider using a windowed buffer.
(< (.-length puts) impl/MAX-QUEUE-SIZE)]
cljs.core.async.impl.channels.ManyToManyChannel.prototype.cljs$core$async$impl$protocols$WritePort$put_BANG_$arity$3 (jar:file:/Users/eklavya/.m2/repository/org/clojure/core.async/0.4.500/core.async-0.4.500.jar!/cljs/core/async/impl/channels.cljs:86:19)
cljs.core.async.impl.protocols/put! (jar:file:/Users/eklavya/.m2/repository/org/clojure/core.async/0.4.500/core.async-0.4.500.jar!/cljs/core/async/impl/protocols.cljs:17:10)
cljs.core.async.put_BANG_.cljs$core$IFn$_invoke$arity$2 (jar:file:/Users/eklavya/.m2/repository/org/clojure/core.async/0.4.500/core.async-0.4.500.jar!/cljs/core/async.cljs:122:20)
cljs.core.async/put! (jar:file:/Users/eklavya/.m2/repository/org/clojure/core.async/0.4.500/core.async-0.4.500.jar!/cljs/core/async.cljs:116:1)
figwheel.client.file_reloading.queued_file_reload.cljs$core$IFn$_invoke$arity$2 (jar:file:/Users/eklavya/.m2/repository/figwheel/figwheel/0.5.19/figwheel-0.5.19.jar!/figwheel/client/file_reloading.cljs:320:27)
figwheel$client$file_reloading$queued_file_reload (jar:file:/Users/eklavya/.m2/repository/figwheel/figwheel/0.5.19/figwheel-0.5.19.jar!/figwheel/client/file_reloading.cljs:318:1)
figwheel$client$file_reloading$figwheel_require (jar:file:/Users/eklavya/.m2/repository/figwheel/figwheel/0.5.19/figwheel-0.5.19.jar!/figwheel/client/file_reloading.cljs:178:30)
Can anyone point me to the right direction here please?So, i’ve solved it by switching to shadow-cljs
which makes things a bit faster as well.
https://github.com/PhaserGameDev/phaser-cljs-playground
Hi !
I'm developing a Reagent/React Native app and I'm stuck for concatening ratom state which contains a JS object.
I would doing like this in ES6 JS : movies: [ ...this.state.movies, ...data.results ]
or the equivalent movies: this.state.movies.concat(data.results)
.
Any clue ? Should I use goog.object/extend ?
thx
(let [state (atom {:movies #js [1 2]})]
(swap! state update :movies #(.concat % #js [3 4])))
updated with js array
@roman01la Thx I"ll tried this
Wondered about this implementation
(defn keyword-identical?
"Efficient test to determine that two keywords are identical."
[x y]
(if (identical? x y)
true
(if (and (keyword? x) (keyword? y))
(identical? (.-fqn x) (.-fqn y))
false)))
vs
(or
(identical? x y)
(and
(keyword? x)
(keyword? y)
(identical? (.-fqn x) (.-fqn y)))
I am hesitant to reply here, because my ClojureScript implementation knowledge is much much lower than my Clojure/Java implementation knowledge, but at least with Clojure/Java, if two keywords "look the same" when printed, i.e. same namespace and name, they always return true for identical?
. In ClojureScript have you found two such keywords where identical?
returns false?
did a quick test in my cljs repl and (identical? :k1 :k1)
returns false
OK, today I learned something. In Clojure/Java having all keywords that 'look the same' also be identical is a source of some efficiency when using them as map keys.
Well, keyword-identical?
is an optimization that is apparently sometimes necessary. But my question was more about the coding style of the function.
There is an optimization in ClojureScript where constants like keywords are pooled (this is the default under :advanced
) and in that situation identical?
starts to be more useful
@andy.fingerhut keywords are not guaranteed to be indentical?
according to the ClojureScript “Differences”
@grav I don’t think either one is more idiomatic than the other. The first is probably much easier for the analyzer to infer types and therefore could end up with more efficient output, though
@grav I do not see a behavior difference between those two ways of writing it, because identical?
always returns true or false. If you do an or
where one of the functions can return a non-nil non-false value that short-circuits the or
, you will get back that as the value of the or
.
/**
* Efficient test to determine that two keywords are identical.
*/
cljs.user.keyword_identical_QMARK_ = (function cljs$user$keyword_identical_QMARK_(x,y){
if((x === y)){
return true;
} else {
if((((x instanceof cljs.core.Keyword)) && ((y instanceof cljs.core.Keyword)))){
return (x.fqn === y.fqn);
} else {
return false;
}
}
});
cljs.user.keyword_identical_SINGLEQUOTE_ = (function cljs$user$keyword_identical_SINGLEQUOTE_(x,y){
return (((x === y)) || ((((x instanceof cljs.core.Keyword)) && ((y instanceof cljs.core.Keyword)) && ((x.fqn === y.fqn)))));
});
@U4YGF4NGM @grav Of historical interest: when keyword-identical?
was written, ClojureScript was still using Clojure's or
macro, so, even though Mikkel has a side point regarding whether the code is idiomatic, it may have actually produced nearly the same code back then.
What we have now is nicer and
and or
implementations that spit out &&
and ||
like in your second example generated from Mikkel's proposed variant.
Is there a straightforward way to see the html a hiccup-like-form will be translated to by reagent?
at a REPL you can do:
(require ‘[reagent.dom.server :as rds])
and then
(rds/render-to-string [:div “foo”])
in the re-frame todomvc tutorial there is a part of a hiccup-returning function that goes
[:ul
(for [todo visible-todos]
^{:key (:id todo)} [todo-item todo])]
with todo-item being a function taking no arguments that returns a function taking one argument and rendering some hiccup.
now I am somewhat confused by the magic here - first, is this translating meta-data to html-attributes (I presume) canonical hiccup? Also, how is this function-call-like syntax there supposed to go? Is it always higher-order functions?there’s really no such thing as canonical hiccup. libraries implement it in various ways
1. Reagent (and some other libraries) extend hiccup to allow a “component” to exist in the first position, just like a keyword :div
. The component will be called with the rest of the hiccup vector as “props”.
2. The metadata used here won’t get converted to html attributes, but is used to signal to React the “key” to use when rendering a dynamic list. It won’t appear in the actual HTML. See https://reactjs.org/docs/lists-and-keys.html for more info
3. The todo-item
implementation that you’re talking about sounds like a “form-2” component and is a way of defining a reagent component. take a look at https://github.com/reagent-project/reagent/blob/master/doc/CreatingReagentComponents.md for the 3 ways of creating Reagent components