This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-05-31
Channels
- # aws (2)
- # beginners (101)
- # cider (8)
- # clara (8)
- # cljs-dev (3)
- # cljsrn (17)
- # clojars (2)
- # clojure (67)
- # clojure-austin (2)
- # clojure-finland (1)
- # clojure-france (5)
- # clojure-italy (3)
- # clojure-nl (3)
- # clojure-russia (2)
- # clojure-serbia (1)
- # clojure-spec (72)
- # clojure-uk (112)
- # clojurescript (92)
- # core-async (74)
- # core-typed (2)
- # cursive (8)
- # datomic (2)
- # duct (5)
- # emacs (35)
- # events (11)
- # fulcro (32)
- # instaparse (9)
- # jobs (1)
- # luminus (1)
- # lumo (3)
- # off-topic (118)
- # om (2)
- # onyx (10)
- # pedestal (5)
- # re-frame (21)
- # reagent (48)
- # reitit (40)
- # ring (12)
- # shadow-cljs (113)
- # spacemacs (21)
- # tools-deps (47)
@marlenefdez here's an implementation of 2048 https://github.com/not-raspberry/cljs-2048
awesome, thanks!
(defreact some-comp-class
(initial-state [] {:text "foo"})
(some-property "hallo")
(update-text! [this ev]
(let [text (aget ev "target" "value")]
(this. setState
#(hash-map :text text))))
(render [this _props _children]
(let [state (this-. state)]
[:div
[greet {:name (:text state)}]
[:div [:input {:type "text"
:value (:text state)
:onChange #(this. update-text! %)}]]])))
I decided I wanted to write some JS in CLJS today 😛@bhauman, is this your implementation of 2048?
@bhauman ah thanks! also, wow! you wrote figwheel?!😮😮
thanks for the example - i'm still faily new to this all, so it's nice to be able to look at some code that's modular and follows best practices
@marlenefdez I would definitely start really really small
what's an example of very small?
so far, i've implemented which
in Clojure
very cool, the clojurescript env is harder than clojure, I'd recommend lein new figwheel --react
and don't add any additional libs
(which is def not webdev lol) but yeah, I think I also need to take a step back and maybe review basic web dev
and thanks for the suggestion, i'll start there
In clojurescript source here https://github.com/clojure/clojurescript/blob/master/src/main/cljs/clojure/browser/dom.cljs there is a [clojure.browser.dom] namespace how can one require this namespace in clojurescript program?
Is there a workaround to use js object functions with clojure functions that require them, juxt comes to mind, trying to call (juxt .a .b)
throws an error for the dots. Is there a deferred prototype function construct in cljs?
Ah that did it.
Does Closure's goog.object contain the equivalent of select-keys
for js-objs?
The closest one would be filter
and filter by predicate “key is in set of keys” https://google.github.io/closure-library/api/goog.object.html
Nice find
Looks like filter-fn has the signature (fn [key object])
Came up with this
(defn select-obj-keys
[o ks]
(let [r #js {}]
(loop [ks (seq ks)]
(if ks
(let [k (first ks)]
(when (goog.object/containsKey o k)
(goog.object/set r k (goog.object/get o k)))
(recur (next ks)))
r))))
Came up with this
(defn select-obj-keys
[o ks]
(let [r #js {}]
(loop [ks (seq ks)]
(if ks
(let [k (first ks)]
(when (goog.object/containsKey o k)
(goog.object/set r k (goog.object/get o k)))
(recur (next ks)))
r))))
has anyone found any convenience functions/macros for working with Immutable.js structures from ClojureScript? Maybe I'm doing something wrong, but currently I don't seem to be able to use normal CLJS functions on, say, Immutable.js Lists - e.g. I can't do (map some-fn some-immutable-js-list-var), instead I have to do (.map some-immutable-js-list-var some-fn), etc.
@samuel.wagen can't you use the entries
method? https://facebook.github.io/immutable-js/docs/#/List/entries
Hmm I’m trying to update to 16 of react/reagent but I have an issue with updating
(def css-transition-group
(reagent/adapt-react-class js/ReactTransitionGroup.CSSTransitionGroup))
it gives Invalid Hiccup form: [nil {:transition-name "slide",...
previously it worked fine (with the React addons)[css-transition-group {:transition-name "slide"
:transition-enter-timeout 500
:transition-leave-timeout 300}
^{:key key}
[:div.popup-holder.animated
{:on-mouse-down (fn [e] (.stopPropagation e))
:style {:left (:left position)
:top (:top position)}}
[popup-content @popup opts]]]
basic ideadid anyone experience a similar problem while updating?
does js/ReactTransitionGroup exist? @joelkuiper
yep, although I only see CSSTransition, not CSSTransitionGroup
using [cljsjs/react-transition-group "2.3.1-0"]
I guess the api changed? https://reactcommunity.org/react-transition-group/
thank, that works!
as in, it no longer gives an error; still doesn’t animate though 😛
happy to help half-fix this 🙂
The rest wasn’t too bad, I only used in like 3 places so porting to the new API was doable! Thank you for pointing me in the right direction 😄
@jacob.haag I see these options https://github.com/technomancy/leiningen/blob/stable/doc/DEPLOY.md#authentication
:deploy-repositories [["snapshots" {:url ""
:username "ui-user" :password "******"
:sign-releases false}]
["releases" {:url ""
:username "ui-user" :password "***"
:sign-releases false}]]
I’m trying to add a webjar and getting
java.lang.IllegalArgumentException: No matching field found: getResult for class org.eclipse.aether.collection.UnsolvableVersionConflictException
at clojure.lang.Reflector.getInstanceField (Reflector.java:271)
Anyone seen this before ?
@vijaykiran webjars inherit the version range madness from npm that might explain the UnsolvableVersionConflictException
yeah seems like it 😞
@metacritical just require clojure.browser.dom
ie. (ns my.namespace (:require [clojure.browser.dom :as dom]))
@bhauman Thanks a lot for the reply. Actually i was trying to reuse some of the functions mentioned in dom.cljs, But i got confused when i looked at the sample app in clojurescript source called “twitterbuzz” which instead of reusing those functions copy-pasted those functions into dom-helpers.cljs https://github.com/clojure/clojurescript/blob/master/samples/twitterbuzz/src/twitterbuzz/dom-helpers.cljs but now i understand it is the same as using any other namespace.
decided to try and see how much I could get close to OG React API while still using hiccup syntax: https://twitter.com/lilactown_/status/1002043921030041600
not sure I understand what the this.
macro does. why not just write #(. this update-text! %)
?
hm. the way it gets serialized when the class is created doesn’t allow that to work
is the (render [this ...])
not creating a regular binding? now I'm scared to ask what the defreact
macro does 😉
it's just a regular binding, yes. but when you put a method/property on the class I'm doing some munging to serialize it and so it gets put on the JS obj literally as "update-text!" instead of update_text_BANG or whatever (. this update-text! ...)
tries to do
ah doh. nevermind then. the indentation always bothers me, just doesn't look right. easy fix in cursive but no idea about emacs.
yeah, I've seen some people putting metadata on macros for that in certain contexts and was wondering about that!
I haven't put in any effort to research what I could do and what's supported for cursive/Emacs
cursive has a setting to "Default to Only Indent" which is the better default imho. no idea if there is an equivalent in emacs
just wondering: cljs is using goog closures under the hood, right? Any particular reason to choose for goog closures and not for ES6 modules?
ESM didn't exist when ClojureScript was released. Also ESM are not suited for actual deployment so things are usually compiled/optimized/bundled together anyways so the input format doesn't matter too much.
yeah, was just wondering 🙂
I started on a patch to improve cljs.spec.test
last week, but it hasn’t been acknowledged in any way yet. Do I need to announce it somewhere else, or just be patient? https://dev.clojure.org/jira/browse/CLJS-2758
@christian767 there is a dedicated #cljs-dev channel where you might get a bit faster feedback but yeah "be patient"
i am porting the CPS transform compiler of http://anglican.ml to clojurescript.
i have succeeded in porting it to cljs on the JVM so far, but i am trying to figure out what is necessary to make macroexpansion properly work with self-hosted cljs (cljs.js)
i think klipse or https://oakes.github.io/paren-soup/ might be a good editing environment similar to http://webppl.org/
this will probably be most interesting to programmers, but compared to the competitors (mc-stan, edward+tensorflow, pyro on pytorch) we have to show why lisp is a good idea and make it appealing
any wishes or good ideas of how to convey this? i thought that an adaptive (intelligent) UI might be cool, but i am not sure how practical this is
this intersects with clojure for datascience in the sense that we have worksheets in gorilla REPL that i can parse and retarget to different presentation formats (e.g. clojupyter). it would be possible to target a pure cljs worksheet renderer as well. what is needed there is markdown+mathjax support and some interactive programming environment
the more technical thing would be some pointers of how to deploy a complicated library like anglican with self-hosted cljs in a life coding environment. i have to be able to do a complicated macro-expansion of the CPS expressions in the browser
this should not be too hard to do, i am right now just not sure how to properly require the namespaces in the browser
@whilo One way to ship static source to the browser is illustrated in https://github.com/ctford/klangmeister, but you can define cljs.js/*load-fn*
any way you like
so normally i use reader conditionals in functions while in macros i use the if-cljs macro from chas emerick to distinguish between hosts