planck

Planck ClojureScript REPL
jonas 2016-05-15T08:47:10.000073Z

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

slipset 2016-05-15T09:32:34.000074Z

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

slipset 2016-05-15T09:32:38.000075Z

Things are moving fast

slipset 2016-05-15T09:32:53.000076Z

https://github.com/r0man/cljs-http

mfikes 2016-05-15T13:14:54.000078Z

@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]]
       #_=&gt;          '[<http://planck.io|planck.io> :refer [reader]])
nil
cljs.user=&gt; (with-open [rdr (reader "/Users/mfikes/Desktop/foo.txt")]
       #_=&gt;  (binding [*in* rdr]
       #_=&gt;   (read-line)))
"This is the first line."
cljs.user=&gt; (read-line)
this is typed in directly
"this is typed in directly"
cljs.user=&gt;

jonas 2016-05-15T13:15:27.000079Z

@mfikes: nice, thank you

mfikes 2016-05-15T13:16:06.000080Z

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

mfikes 2016-05-15T13:16:36.000081Z

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

jonas 2016-05-15T13:17:15.000082Z

👍 I’ll try to remember that

mfikes 2016-05-15T13:32:48.000084Z

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

mfikes 2016-05-15T13:38:00.000086Z

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)

slipset 2016-05-15T21:30:34.000087Z

since the http thingy has landed, maybe it’s time to pick up this again...

slipset 2016-05-15T21:32:15.000091Z

this way we could have planck make an http request to a planck web-server

😎 1
mfikes 2016-05-15T21:50:40.000092Z

@slipset: sounds great :)