This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-20
Channels
- # arachne (11)
- # aws (2)
- # beginners (33)
- # boot (167)
- # cider (71)
- # clara (2)
- # cljs-dev (28)
- # cljsrn (3)
- # clojars (1)
- # clojure (83)
- # clojure-austin (21)
- # clojure-dev (24)
- # clojure-russia (19)
- # clojure-spec (33)
- # clojure-uk (108)
- # clojurescript (114)
- # component (1)
- # core-async (1)
- # cursive (7)
- # datomic (13)
- # editors (1)
- # emacs (15)
- # hoplon (10)
- # lein-figwheel (4)
- # leiningen (3)
- # mount (2)
- # om (134)
- # om-next (4)
- # onyx (42)
- # pedestal (41)
- # quil (2)
- # re-frame (29)
- # reagent (4)
- # remote-jobs (6)
- # ring-swagger (5)
- # untangled (9)
@samcf you mean it’s an fn local to some other fn? if it’s really something you need to test why not just lift it out?
if you just don’t want it to appear as part of your public API, ^:private
metadata is a thing, defn-
is the shorthand
@ezmiller77 just my 2 cents, but testing preconditions seems odd to me
@lorenzoi @timothypratley has great free video tutorials! https://www.youtube.com/user/timothypratley/videos
If I want to work with arbitrary precision numbers in CLJS, would it make sense to
1. define cljs.compiler/emit-constant
[1] for the 1.2M
notation
2. to emit js/BigNumber
[2] types, which in turn are
3. converted with cognitect.transit/bigdec
for serialization with Transit and
4. deserialized as java.math.BigDecimal
, so I can
5. persist them as :db.type/bigdec
into Datomic
?
[1] https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/compiler.cljc#L229
[2] https://github.com/MikeMcl/bignumber.js
@onetom I would recommend a different route ... transit allows you to set custom handlers for types
I may be remembering incorrectly, but I'm of the belief that Google Closure contains a bigdecimal equivalent type @onetom
so you can control that java.math.BigDecimal
gets converted to js/BigNumber
and the reverse
@thheller transit converts java.math.BigDecimal
to cognitect.transit.types/BigDecimal
or something like that
it kinda works, btw, im just not sure whats the best way to hook it into the boot-cljs
boot task:
i made this bigdec.clj
:
(ns bigdec
(:require cljs.compiler))
(defmethod cljs.compiler/emit-constant BigDecimal [x]
(cljs.compiler/emits (str "(new BigNumber('" (.doubleValue ^BigDecimal x) "'))")))
and in my index.cljs
i have this:
(ns ^{:hoplon/page "index.html"} page.index
(:require-macros
[bigdec])
(:require
[cljsjs.bignumber]
...
yeah, i know, that's enough pain alone, that's why i thought i could at least make the bigdec literals more convenient to enter
this seems to do the magic, but for example the Dirac REPL doesn't understand the 1.2M
notation and still returns js/Number
, so i should install this whole magic somehow earlier in the build pipeline
you are hacking the compiler ... so you need to hack it for every tool you want to use
it's just a bit annoying not to be able to move data literals back and forth easily, thats all
we are just using dirac quite a lot too, so it would be veeery convenient to have this...
{:foreign-libs [{:file "resources/public/jslib/depends-on-react.js"
:provides ["sample.foreign-dep-on-react"]
:requires ["cljsjs.react"]}]}
I was expecting that this ensures cljsjs.react
is always loaded before depends-on-react.js
is. Seems I am wrong. Any suggestions how to achieve this dependant on the cljs-build?
@thheller It does not work for some reason. And no, :requires
must be an array of strings.
@thheller load order looks fine. Maybe my assumptions about react.inc.js exposing window.ReactDOM
were wrong. Anyways, thanks for your time.
Any recommended step by step tutorials on reagent & reframe for relative novices? I'm running a hackday and would like to build a reactive app step by step in Clojurescript and we got stuck with Om last time. One of the ideas is to build a live voting app for presenters, so the audience can give feedback as they are speaking. It would be great if any tutorials also used Dev cards.
@jr0cket : there's also a #re-frame channel here, the authros of re-frame are there, and they might have helpful insights
So strange, can't find a single example anywhere of using the web cam of phone/device .. e.g. just grabbing the device and streaming out the video, something
i.e. something like this, but in clojurescript .. https://www.webcodegeeks.com/html5/html5-web-camera-example/
@placeboza do you know how javascript interop works? You can just use the functions used in that example from clojurescript using interop
It may be smart to keep all of the js interop in one namespace, like a wrapper, and have the actual functionality in another namespace.
I think I should properly finish learning clojure though, Im too noobish. And not sure if ClojureScript is gonna handle what I want to do
would be easier if I just used the language Im good at, but I love the elegance and concept behind clojure
I think you should be able to get camera access working fairly easily, but the real question is what you want to do with that
Client side object detection? There are js/android libraries for it. Server side something detection? I'm sure you can figure out some data scheme that isn't too taxing
what's the latest thinking on making clojurescript compiles faster during dev? i assume optimizations: none
and using cljsbuild and figwheel all help, but still my repl takes 30 seconds to start, then when i run my app from the repl and startup figwheel it's another 120 seconds of compiling. can we precompile libs?
120 seconds of compiling seems odd unless you have a lot of code or you’re blowing away your build each time
Figwheel Sidecar load time could be decreased if there was an AOT’ed artifact - I’m sure @bhauman has bigger issues on his plate than investigating that
@devth precompiling libs means potentially being locked to a particular version of the compiler - so we haven’t really pursued that idea
is there a good way to check for inconsistent variable access in closure? having some minification errors due things like js/window.top
vs (aget js/window "top")
. Also some errors that are not visible with pseudo-names on.
ok. for the last sentence, i mean that some of the minification errors we've gotten have gone away with pseudo-names turned on, which makes them harder to track down
it is something that started happening after we introduced module splitting. np, trying to take out the foreign libs now.
@isak there’s a known dependency order problem with module splitting now fixed in master
hello, I'm trying to convert some clojure code to clojurescript and currently use the jdbc/postgresql drivers. what is a good clojurescript alt? thanks!
@shicholas do you mean querying using Clojurescript?
uhm, you might need to look at some Javascript lib, I haven't heard of anything like that in cljs
yes I would actually look into that
@shicholas lol I didn't do anything 😄 if you can report back your experience, I am interested 😉