Fork me on GitHub
#planck
<
2016-05-15
>
jonas08:05:10

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*.

slipset09:05:34

@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.

slipset09:05:38

Things are moving fast

mfikes13:05:54

@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]]
       #_=>          '[ :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=>

jonas13:05:27

@mfikes: nice, thank you

mfikes13:05:06

@jonas There is also, planck.core/*command-line-args*

mfikes13:05:36

The big picture is that stuff you’d find in clojure.core may be in planck.core and stuff you’d find in would be in .

jonas13:05:15

:+1: I’ll try to remember that

mfikes13:05:48

@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.

mfikes13:05:00

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)