Is there any support for *in*
and *out*
in planck? I would like to create a cmd line tool, but I'd need at least *in*
.
@mfikes: the irony is that cljs-http bases a lot of what it does on core.async, which was not available when I started the work on http in planck.
Things are moving fast
@jonas: Yes. The intent is to support as much of that as feasible. So for example, you can do the following:
cljs.user=> (require '[planck.core :refer [*in* read-line] :refer-macros [with-open]]
#_=> '[<http://planck.io|planck.io> :refer [reader]])
nil
cljs.user=> (with-open [rdr (reader "/Users/mfikes/Desktop/foo.txt")]
#_=> (binding [*in* rdr]
#_=> (read-line)))
"This is the first line."
cljs.user=> (read-line)
this is typed in directly
"this is typed in directly"
cljs.user=>
@mfikes: nice, thank you
@jonas There is also, planck.core/*command-line-args*
The big picture is that stuff you’d find in clojure.core
may be in planck.core
and stuff you’d find in <http://clojure.java.io|clojure.java.io>
would be in <http://planck.io|planck.io>
.
👍 I’ll try to remember that
@slipset: Yeah. With respect to baking core.async
into the API, I think I agree with Eric’s post: http://www.lispcast.com/core-async-code-style In other words, it argues that an optional callback in the planck.http
API would be cleaner.
It is very easy to make a wrapper that then converts from callback-style to core.async
by doing something along the lines of:
(let [ch (chan)]
(get url {:cb #(put! ch %)})
ch)
since the http thingy has landed, maybe it’s time to pick up this again...
https://github.com/mfikes/planck/compare/master...slipset:sockets
this way we could have planck make an http request to a planck web-server
@slipset: sounds great :)