This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-06-08
Channels
- # admin-announcements (3)
- # arachne (1)
- # aws (2)
- # beginners (10)
- # boot (287)
- # cider (5)
- # clara (2)
- # cljs-dev (150)
- # cljsjs (2)
- # clojure (99)
- # clojure-austin (1)
- # clojure-brasil (1)
- # clojure-dev (13)
- # clojure-greece (55)
- # clojure-japan (1)
- # clojure-nl (2)
- # clojure-russia (24)
- # clojure-spec (184)
- # clojure-taiwan (1)
- # clojure-uk (45)
- # clojurescript (55)
- # clojurex (1)
- # cursive (20)
- # datascript (16)
- # datomic (1)
- # devcards (4)
- # events (10)
- # figwheel (1)
- # funcool (7)
- # hoplon (48)
- # immutant (1)
- # jobs (6)
- # lambdaisland (2)
- # lein-figwheel (19)
- # mount (36)
- # off-topic (37)
- # om (16)
- # om-next (17)
- # onyx (29)
- # planck (53)
- # proton (1)
- # pure-frame (1)
- # re-frame (40)
- # reagent (44)
- # remote-jobs (1)
- # ring (2)
- # robots (2)
- # rum (5)
- # slack-help (4)
- # spacemacs (27)
- # specter (82)
- # test-check (18)
- # test200 (1)
- # untangled (17)
hi, is core.async supported on planck? I am getting namespace not found on cljs.core.async
@johanatan: There is a port called Andare that works with bootstrap ClojureScript: https://github.com/mfikes/andare
@johanatan: Quick Start https://gist.github.com/mfikes/22f553d8c9186dcc613e1263ca9deeda
And post (which probably doesn’t offer more info): http://blog.fikesfarm.com/posts/2016-05-15-bootstrap-core-async.html
[I'm not using lein or boot or anything as it's a pretty simple script: in fact, here's the entire project: https://github.com/johanatan/screencap ]
@johanatan: just download the JAR and use Planck's -c
option with the JAR
by download, you mean clone the src and build the .jar myself? or is it hosted somewhere?
@johanatan: It is on Clojars… hmm is there a way to just download directly from there without any other tooling?
If you have lein
, you can make a small project.clj
file specifying [andare "0.1.0”]
just to get it
btw, is there an async version of sh
? i'm guessing not since there wouldn't really be any way to express that without andare
@johanatan: Also, once you set up Planck to use it you’ll definitely be interested in Planck’s ability to cache with -K
or -k /some/path/to/cache-dir
, otherwise it can take 15 seconds or so to load the core.async
namespaces
No, none of the side libraries in Planck currently offer callback-based async support.
But, you could imagine an async sh
which called back with the results instead of returning them
Yes. To be honest, I never can remember how to even build up strings in Bash. In ClojureScript we all know it is done with str
🙂
It really makes bash utilities way more useful to me since I never learned/internalized enough bash to do anything reasonably complex. Even something as trivial as iterating over the output lines from ls
goes a long way. Especially when you can do that sort of thing to get some input data or what have you and then you’re back in Clojure.
@johanatan: That’s a cool script. Yes, you should be able to use cljs.core.async/timeout
to make your loop at the bottom sleep a bit before looping back around
@noonian: Yes. One thing that shows just how far we have come with ClojureScript (and is close to your example) is the one-liner in https://gist.github.com/mfikes/9503aa2555aac1cafaf4 where Rich’s demo involved first AOT-compiling some code and then running it in Node
Ran into a little snag: having just a top-level go
routine with infinite loop inside returns immediately (whether or not it is inside a main and -m is passed).
When I do this from a regular Node.js ClojureScript project, it works as expected-- i.e., the program hangs while the go routine handles all processing rather than exiting immediately.
@johanatan: Thanks! Fix pushed to master. Now code like the following will keep script processing “alive” until complete:
(go
(loop [n 10]
(when (pos? n)
(<! (timeout 1000))
(println n)
(recur (dec n)))))
You can brew master (see http://planck-repl.org/setup.html) or let me know if you’d just like a binary you can download.Reading @johanatan's screencap—did not realize that planck included goog.*! I realized I have a very hazy idea about the differences between Planck/JavaScriptCore and "regular Cljs"/Google Closure
If interested, here is how Planck includes stuff in its binary: http://blog.fikesfarm.com/posts/2015-07-27-island-repl.html
I've had this feeling before (the surprise at finding out google closure was included), when I found out Planck included transit
Yes, Transit is kind-of exposed by accident. I should probably just commit to it being there and list it in http://planck-repl.org/dependencies.html
I haven’t thought of a good way to cope with the fact that some of the things that Planck uses are simply available to Planck end-users.
In terms of what “most” means wrt Google Closure, stuff is pulled in intentionally here: https://github.com/mfikes/planck/blob/master/planck-cljs/src/planck/bundle.cljs
@johanatan: I don't think you have to do the stuff with st
and eval
in screencap's main.cljs
just to read in the EDN config. This seems to be sufficient: (1) add [cljs.reader]
to your requires, and (2) (def config (cljs.reader/read-string (slurp "./config.edn")))
FWIW, there is also planck.core/eval
and I’m working on adding read
if it proves to be useful: https://github.com/mfikes/planck/commit/f1b8547bf2a42bc06d04e81d52048555ba223c60
@fasiha: ahh, nice. Ya I tried to get reader to work but didn't stumble onto that particular incantation I suppose
Doesn't help that everything returned from google when searching for 'ClojureScript reader' involves the 'reader conditional'
@mfikes: I'm reading Clojuredocs for read
and read-string
side by side trying to understand the difference—it looks like the former consumes something not-stringy, a "push-back reader"?
@fasiha: Yes. For example, the version of read
I’ve been working on for Planck supports unread
: https://github.com/mfikes/planck/blob/f1b8547bf2a42bc06d04e81d52048555ba223c60/planck-cljs/src/planck/core.cljs#L69-L72
I'm guessing reading a Clojure expression from a stream, then unreading it (pushing it back) is useful even though I can't see how.
@fasiha: I think it is just a concession that makes a reader easier to implement. For example, when reading 17(+ 2 3)
the reader starts parsing the number at the beginning, but then it hits the (
and concludes that the number 17
has been fully parsed and simultaneously puts the (
back on the stream, unwinds the stack and continues, starting afresh with (+ 2 3)
in the stream.