This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # admin-announcements (1)
- # aleph (1)
- # arachne (10)
- # beginners (6)
- # boot (81)
- # braveandtrue (3)
- # cider (42)
- # cljs-dev (1)
- # cljs-edn (52)
- # cljsjs (9)
- # cljsrn (9)
- # clojure (62)
- # clojure-austin (1)
- # clojure-belgium (11)
- # clojure-berlin (2)
- # clojure-gamedev (2)
- # clojure-greece (1)
- # clojure-russia (73)
- # clojure-uk (98)
- # clojurescript (156)
- # community-development (4)
- # component (3)
- # cursive (30)
- # datascript (10)
- # datomic (17)
- # emacs (5)
- # events (1)
- # hoplon (315)
- # jobs (1)
- # jobs-discuss (3)
- # lein-figwheel (6)
- # luminus (18)
- # off-topic (13)
- # om (130)
- # other-languages (122)
- # re-frame (32)
- # reagent (27)
- # rethinkdb (6)
- # ring (2)
- # ring-swagger (31)
- # spacemacs (4)
- # untangled (6)
- # yada (30)
Here's a straightforward Reagent / reframe SO question: http://stackoverflow.com/questions/37164091/how-do-i-loop-through-a-subscribed-collection-in-re-frame-and-display-the-data-a/37168749#37168749. I've heard people say here that
map is prefered to
for with Reagent. Can someone tell me what it is and I'll add it in (or put your own answer obviously)? I think people know that
map is better than
for, but most of us glance over the technical reason for this...
@cjmurphy: I use
map instead of
for because I can never remember the syntax for the latter 😕
@abdullahibra: what you're asking for is a Distributed System. Which are hard. https://github.com/aphyr/distsys-class and also https://www.somethingsimilar.com/2013/01/14/notes-on-distributed-systems-for-young-bloods/ were helpful for me when getting started thinking about this kind of thing. Even now, cljs libraries like Om Next and posh are just figuring out how to do client⇔server⇔other clients transfer reliably and efficiently. You can hand-roll something simple, for sure, but in general, the problem is hard, so things like Firebase, Parse, Meteor, etc. exist and are popular (though some of those complect other concerns too).
What is best practice in serializing js-objects to edn?
I have a
(goog.date.Date.) that I would like to serialize and store. With
pr-str I just get
"#object[Object 20160512]” which naturally fails to be parsed by
cljs.reader/read-string. Seems like tagged literals is not fully supported in cljs still?
You probably want cljs.reader/register-tag-parser!, example here: https://git.io/vrt8Q
@danielwoelfel: Where do I add the tag and transform the object when writing it? I don't have to traverse the data structure first and replace all occurrences of goog.date.Date right? My initial hypothesis was that
pr-str would have an optional argument with serializing functions.
print-method under the hood, which is a multimethod, so you can add implementations for new types
seems it isn't true in Clojurescript... I can trace it down to
pr-writer-impl, but it doesn't seem like there's an easy way to extend it
@dnolen I noticed you said you don’t use loops which is all Clojure seems to offer. How do you do recursion in Clojure because it’s not very Clojure to use recursion as far as I have seen?
urbanslug: Recursion is done with the loop/recur form, because the compiler doesn’t otherwise do any tail call optimizations. It’s dogma not to use it in end-user code, though a lot of core functions are implemented with it.
anyone know how i can see output to
*err* during cljs macroexpansion... it's being suppressed in my setup
@risto: I thought TCO was new in JS, based on things like http://www.2ality.com/2015/06/tail-call-optimization.html ?
@fasiha: Yeah, ES6 is still pretty new and not fully implemented in browsers. Everyone is still targeting ES3 or ES5. I think ClojureScript could implement true TCO similar to how Babel has done it, and it would work for older browsers too.
I know Fable, the new F#->JS compiler, does it by just compiling to ES6 and feeding that to Babel, but CLJS isn’t likely to go down that route.
@risto what's the difference between the current TCO and the true TCO you're referring to?
I could feel myself getting more and more educated the more of it I read @mikethompson !
@lewix: Partly, I suspect he means that in most languages TCO is done for the whole program. Clojure’s is limited to the loop/recur form which IIRC just uses some local optimisation tricks to turn itself into a loop. It definitely can’t do clever stuff like mutual recursion (though I don’t think ES6 can do that either)
@lewix @jarcane: From my understanding,
loop-recur TCO only works for self-calls.
Kawa Scheme apparently does have full TCO but it has performance and interop consequences when enabled. http://www.gnu.org/software/kawa/Options.html#Options-for-compiling-and-optimizing
Well, in any case, would something in a tail call position be transpiled like that via closure?
In other words, once browsers implement TCO for JS (because of ES6), then clojurescript would get that for free
sure typical Scheme textbook algorithms, after a lot of time with Clojure, I just don’t think it really matters much other than “that’s pretty"
Yeah, Clojure can probably get away with making most non-recursive algos still completely readable. But in a lot of languages the recursive form definitely is easier to read.
is there any example of an :externs shimmed standalone library I can copy? there’s a security flaw in a current cljsjs lib and while I’ve got a PR to update it I need to move more quickly than they are
You can also just set up deps.cljs on your app project and include extern in the project
we’re using jitpack internally, so I can easily throw up a vendored version of the auth0 lib
Both of these libraries required messing around with their respective upstream build pipelines, which is a no-no for the CLJSJS team. But if you're trying to rope something in and the authors didn't like using
--standalone for browserify you're sort of screwed...
@xcthulhu: What do you mean with "messing around with build pipelines"? I think some cljsjs packages modify some build configuration or something like that
Anyway, packaging JS libs separate from Cljsjs is fine. Makes my life easier when I don't have to maintain them.
@juhoteperi: In the case of bitauth, I have to go in to their gulp file and monkey around with their browserify command (or skip their build system all together and run browserify out of band).
Incremental-dom package script seems to be doing something similar: https://github.com/cljsjs/packages/blob/fc2ce546cf39e7f562fb0e275f7822127ebc61fc/incremental-dom/build.boot#L34
In the case of SJCL, I have to pull down the clojure compiler and compile with simple optimizations, set pretty-printing to true, and wipe their comments and run their unit tests over the result to get a functional "unminified" version of their library. I wish it wasn't so but SJCL both needs the closure compiler's optimizations to be functional and also fails to write their javadoc comments in a way that doesn't make the closure compiler throw a fit.
In the case of bitauth, I'm ready to retire that library. An upstream dependency (elliptic.js) doesn't support advanced compilation and it's too much yak-shaving to fix.
@juhoteperi: Sadly, SJCL's bignum library is actually more functional than the google closure library's goog.math.Integer 😞
At this point I've sunk like 100 hours into this little hall of mirrors that is JS crypto libraries.
@all: What are people's thoughts on
js/window.crypto.subtle ? Would a clojurescript wrapper + polyfill for legacy browsers be welcome?
So I finally got my CIDER + Boot + browser-REPL setup sorted out...now have no problems getting two REPLs established, one for CLJ, one for CLJS. Thanks to everyone who offered suggestions and pointers to tutorials. I've got Reagent on the front end, and a whole lot of data on the backend I want to turn into dynamic visualizations. Any recommendations for where to look next for a good way to set up the flow?
Scanning the (extensive!) re-frame README, the bit that's currently missing for me is how the data gets from the backend into the
Say I've got some metrics that take a fair number of CPU cycles to crunch coming in on the backend. What are the architecture options for pushing that stream out to the CLJS side of things on the browser?
whatever floats your boat really, rest, websockets.. https://github.com/ptaoussanis/sente is pretty awesome
Cool. I poked around with sente + Om a year ago, but only to get a toy scenario set up. If that's still state of the art, I'll dive back in. Thanks!
if you haven't checked it out yet: https://github.com/danielsz/system makes things a breeze, atleast for the backend part
I've worked with component in the past, but not system. I think I've heard it plays nicely with Boot?
This is the first project I've converted to Boot, and I'm really liking it. Faster and lighter, and it's been really easy to stick my fingers into the pie when I needed to make some tweaks.
Any thoughts on http-kit vs Immutant? I used http-kit the last time I was playing around with sente.
@patapizza: These benchmarks are kind of old, but immutant has better performance: https://github.com/ptaoussanis/clojure-web-server-benchmarks
@pataprogramming: Yea it does play very nice with boot indeed, coming from gradle boot was a no brainer as soon as i saw it. 😛 Can't comment on http-kit vs immutant, but shouldn't really matter as you can switch at any time with sente.
Hi all, stupid question - is it possible to make cljsbuild faster (cache, multi-threading, etc)? It's becoming slowest part in our Continuous Delivery Pipeline 😞
But not - parallel build ?! We have just a couple of builds - should we split them somehow?
@fenton: if it’s a web app in a mobile browser on iOS you can debug, also thought this was true for Android
for native, I suppose you’ll have to be OK with logging if your platform doesn’t have better JS debugging integration
@dnolen what I was trying to do is serve it up with boot and the various cljs-repl, reload, etc..., then i should have all the power of a repl, cider, etc... however am having trouble using this arrangement when all devices are not the localhost.
@fenton: I would get this working with the simplest thing first if you’re just interested in debugging
for example, some mobile phones dont work...for some reason, but I don't have access to the phone, but if they connect to the site....then with the above setup, theoretically, I'd be golden with a repl in their browser.
as far as making this work with every possible mobile phone - probably not gonna happen
true for sure, but this development setup would be powerful... i think everything is basically there for this setup too... raised an issue with boot-cljs-repl...
well in my mind at least actual debugging means source mapping and stepping, you need access to the phone for that
spending a lot of effort to just get a REPL to some random phone doesn’t sound like it would help that much with serious debugging at least to me
but i dont think this needs to be setup for each different phone...it should be a generic setup for any browser connected device.
well also being to connect to someone else device via browser through a REPL is also a probably a pretty bad security hole so I don’t know 🙂
i'd just serve the static files...but when they aren't working i can wind up this jetty served site with all the repl connection trappings...
@fenton: well if this is for debug builds then I don’t see why it couldn’t be made to work
@dnolen. basically my setup is I'm running the site on a remote server. In the simplest case, I open up a local browser (just as a test) that is pointed to this remote server (being served by boot cljs-repl reload serve, etc...). At this point everything is fine. Then I open up a repl (either cider connected or a terminal right on the server), but (start-repl) but weasel complains, hangs... The bug i raised for it is: https://github.com/adzerk-oss/boot-cljs-repl/issues/41
I'm pretty noob'ish on the build tools...so perhaps i'm doing something wrong...or maybe there is a bug... a bit surprised others haven't run into this tho... would make mobile development a lot easier IMO
@fenton: I haven’t been following the cider integration, and definitely not weasel or piggieback, I suspect you may have more luck with Figwheel
@fenton: People developing for mobile platforms are small section of people writing Cljs (or using Boot) and people using browser-repl are another small section, those who use both are even smaller section
@juhoteperi: but i think developing for mobile should be peoples first thoughts when using cljs, no? Mobile is the future right?
@fenton now that I understand what you are trying to accomplish, I’ve had stuff like this working before BTW
I think like 3 years ago I played around with browser REPL interacting with many connected clients - desktop browser, iPad, and iPhone, and Android device browsers
@dnolen yes, i'll give that a try, not sure conceptually if it makes sense as I haven't used figwheel for sometime now...but i guess it should?
@dnolen yes you are right... just haven't used figwheel for a while...sorry my statement was not helpful 🙂
I’m only suggesting it because it’s really popular and thus probably less issues, more help
People who have rich text editors in their app, how did you do it? 🙂 I recently stumbled upon https://github.com/bustlelabs/mobiledoc-kit and the more I'm playing with it the more I'm liking it. Draft is an alternative but mobiledoc seems much simpler
hello! What is better? react-native with a clojurescript wrapper or lein-droid package?
@fenton At the last Clojure/West the Untangled team had a nice feature for bug reporting...a classic log of all the events up to the bug, which is not step through but very neat 🙂