This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-04-27
Channels
- # beginners (35)
- # boot (111)
- # cider (12)
- # clojure (295)
- # clojure-android (2)
- # clojure-dev (12)
- # clojure-dusseldorf (9)
- # clojure-finland (1)
- # clojure-greece (7)
- # clojure-italy (24)
- # clojure-norway (1)
- # clojure-poland (7)
- # clojure-russia (14)
- # clojure-sg (1)
- # clojure-spec (29)
- # clojure-uk (25)
- # clojurebridge (1)
- # clojurescript (157)
- # clr (3)
- # cursive (3)
- # datomic (55)
- # docker (6)
- # hoplon (4)
- # juxt (11)
- # leiningen (13)
- # luminus (1)
- # lumo (3)
- # mount (1)
- # off-topic (47)
- # om (43)
- # onyx (35)
- # re-frame (33)
- # reactive (2)
- # reagent (4)
- # rum (3)
- # schema (5)
- # specter (5)
- # test-check (63)
- # vim (15)
- # yada (14)
@oahner @thheller I was stringifying the data further down the stream. Sorry for the noise.
Pretty sure it's working. Transfer speed hasn't improved much, but at least the main thread doesn't hang trying to convert the results to the array.
So I'm building a cellular automaton to show tradeoffs of using web workers in this agent way. I've got the automaton processing on both the main thread and the web worker, showing the difference between the two. Pretty fun little exercise.
I've got an idea to process the whole thing in triangle patches, which will allow parallelization for a particular number of consecutive rows.
how would i achieve this in clojurescript?
(defrecord ReversibleTie [a b])
(extend-protocol Reversible
ReversibleTie
(my-reverse [tie] (->ReversibleTie (:b tie) (:a tie)))
js/String
(my-reverse [s] (->> s
reverse
clojure.string/join "x")))
The code complies, but doesnāt work. as in, (my-reverse "hello")
fails because their is no my-reverse definedwho defines the Reversible protocol?
@noisesmith I was sort of hoping clojurescript. But i wouldnāt be suprised to learn that it doesnāt exist. Part of what i was confused about was how to figure out what protocols current existed in clojure/clojurescript.
so, when implementing Reversible
, you can only implement methods that are actually defined on that protocol
if it even exists...
even if clojurescript defined a Reversible protocol, it wouldn't have a method called my-reverse
but you are free to define Reversible, and call a method my-reverse
ouch, yea. That makes sense. How do you go about finding out what protocols exist? are they listed somewhere.
I don't know if there's good documentation, but there's a namespace that has them in cljs - one moment
https://github.com/clojure/clojurescript/blob/master/src/main/cljs/cljs/core.cljs#L449 - these are the main ones at least
@drewverlee here's the one https://github.com/clojure/clojurescript/blob/master/src/main/cljs/cljs/core.cljs#L643
awesome! I think i get it, lets see if i extend the actual protocal thenā¦
is there perhaps a way to build multiple disparate :main cljs builds in parallel with cljsbuild? right now weāre doing cljsbuild id id2 id3
which does them in serial, which is much faster than do cljsbuild id, cljsbuild id2
. but i wonder if perhaps we can build multiple entrypoints in parallel in a single cljsbuild call somehow? cc @dnolen
@robert-stuttaford in theory with :parallel-build true
doing multiple builds in serial should be fastest since each successive build can re-use the analyzer data from the previous
but FWIW I think it is safer to not share analyzer data between builds, so do
should be "safer"
cool, weāre doing :parallel-build true + one process already, so i guess weāll just add cores until itās as fast as it can be for now š
hmm you are probably stuck waiting for closure? that part could definitely be done in parallel
almost certainly, yes
weāre building about 6 apps, and some of them have an :advanced + :pseudo-names true variant
(apply (.-methodName object) args)
?
@savelichalex ah, of course! thanks
@robert-stuttaford Iām sure you could do it manually with your own script - cljsbuild used to have that feature but it I believe the problem was that it tried to share the compiler state atom across very different builds which isnāt a good idea
I'm aware of libraries like Om / Reagent / Re-Frame and why I should use them. However, assume I'm bent on directly manipulating the DOM. I want to keep hiccup style notation for creating DOMs (instead of directly using strings myself). Is there a library that will let me directly modify the DOM with hiccup like notation ?
@robert-stuttaford still @thheller might be right here and youād have to do some testing to see
Hi, problem with building -
Circular dependency detected, cljs.core -> cljs.core
[org.clojure/clojurescript "1.9.521" :scope "provided"]
in build directory there are two files core.cljs and core.cljc (which requires cljs.core.cljs)
@theller
{:source-paths ["src/cljs" "src/clj"]
:cljsbuild
{:builds
{:ui {:source-paths ["srcs" "env/prod/cljs"]
:compiler
{:main "ui.prod"
;; :foreign-libs []
;; :externs []
:output-to "build/js/ui.js"
:output-dir "build/js/out"
:optimizations :advanced
:pretty-print false}}}}
@qqq you could try https://github.com/thheller/shadow specifically the shadow.dom
namespace. I have been using that quite some time. not well documented but pretty straightforward.
that looks correct although "srcs"
looks a bit suspicious since you already have src/clj
and src/cljs
?
cljs.core.cljc
(:require clojure.walk
clojure.set
[clojure.string :as string]
[cljs.compiler :as comp]
[cljs.env :as env]
#?(:clj [cljs.support :refer [assert-args]])
#?(:cljs [cljs.core :as core]) <- HERE
#?(:cljs [cljs.analyzer :as ana]))
thanks @dnolen !
Are there any common pitfalls which break Closure compilers cross-module code motion? All namespaces and dependencies I donāt explicitly include in some moduleās :entries
end up in the :cljs-base
module, though the clearly could be.
@kommen the :modules
implementation is buggy IMHO. https://dev.clojure.org/jira/browse/CLJS-2011
you can try https://github.com/thheller/shadow-devtools/wiki/ClojureScript-for-the-browser if you want š
that includes hash-map construction, defmethod
, anything that swaps into an atom, etc
for example my :editor
module has editor.core
in its :entries
. only editor.core
or namespaces required by it require reagent. but reagent still ends up in the base module
yeah things like that shouldn't rely on code motion at all as we can figure that out just by looking at the requires
this pretty much covers everything already https://github.com/thheller/cljs-issues/tree/master/modules š
suppose you were writing an app, where all it is is 100,000 circles (in svg) moving around randomly; for an app like this, would it be more appropriate to (1) use react / om / re-frame / some type of diffing or (2) just manipulate the dom directly?
@qqq I suppose with that many circles you want canvas (not svg) but react would not be ideal I think
@qqq I would strictly break such app into two parts: 1) āengineā 2) ālogicā => I would write the engine in plain js with direct DOM manipulation (performance sensitive code), and the logic in clojurescript (as a scripting language, not performance sensitive code) - the engine api should be suitable to expected usage, e.g. submitting js array of data for each frame, or provide just selective updates, it depends on usage
darwin: but you also would use canvas rather than svg, and "render each frame from data" rather than "just update fieds/properties of what changed" ?
if you are going to do some ridiculous amount of circles all moving every frame then I would consider webgl instead
some guy just wrote a live coding env in a web browser and replaced all of the UI components with shader blobs, it sounds mad (it is) but the text looks ace zoomed in
all of this is web gl https://youtu.be/yOiuJ_Gll_E
and you can try it out here https://makepad.github.io/makepad
in cljs, after I create a new pop up window with js/window open ... , I seem to have race conditions dealint with accessing divs of the window
a JS lib is passing back an Object of data to my cljs. Is there a cljs method to show me the content of that data?
hmm, so the value being sent to me by JS logs to the console as
{:source [{source /dzi/madonna.dzi, eventSource #object[Object [object Object]], userData nil}]}
time to get figwheel and cursive working together so that I can actually have a REPL and see values, I guess.
@mobileink : fair enough, not everything done in cljs is on topic for #cljs
I had to go. But I think text rendering can be done with webgl without blur. This experimental project is state of the art IMO: https://github.com/evanw/sky
@darwin: I think that's the same person behind http://thetamath.com/app/abs(x%5E(2)-1)=abs(y%5E(2)-1)
and the author of https://medium.com/@evanwallace/easy-scalable-text-rendering-on-the-gpu-c3f4d782c5ac
qqq posted it already https://medium.com/@evanwallace/easy-scalable-text-rendering-on-the-gpu-c3f4d782c5ac
I almost attempted that until (1) found his code was in Skew (???) and (2) each char gets blown up to like 100 triangles (in particular, # of control points)
i'm very interested in this, but maybe #off-topic is better? since we do not have #typography.
how does everyone load cljs namespaces in a lein project into the repl?
Is there an html generation lib Ć la hiccup that works across different targets? i.e. jvm, JS
It may be possible to take the hiccups version and make a cljc version, by pulling in bits from the clj version.
Though that's a different workflow, potentially negating the benefit you were looking for in a cross-platform solution
something like: https://github.com/reagent-project/reagent-cookbook/tree/master/recipes/reagent-server-rendering
oh, I am familiar with server-side rendering, was wondering how that ties into the conversation is all
prepending āfun fact:ā to āCould potentially do server-side rendering with the hiccups libā š
Yeah, I guess I got the rendering backwards š hiccup is already "rendering" the html server side.