planck

Planck ClojureScript REPL
cvermilion 2016-07-18T19:53:27.000003Z

@mfikes — a suggestion: it would be nice for scripting to have something like (slurp *in*)

mfikes 2016-07-18T21:59:51.000004Z

@cvermilion: Seems like a reasonable thing to do. If you can brew HEAD I dropped some code supporting that in master.

mfikes 2016-07-18T22:00:29.000005Z

Here is an example:

$ cat foo.cljs
(ns foo.core
  (:require [planck.core :refer [slurp *in*]]
            [<http://planck.io|planck.io>]))

(-&gt; (slurp *in*)
  count
  println)
$ wc foo.cljs
       7      13     122 foo.cljs
$ planck foo.cljs &lt; foo.cljs
122

mfikes 2016-07-18T22:04:13.000006Z

If you decide to brew HEAD, note the bit about brew edit planck at http://planck-repl.org/setup.html

mfikes 2016-07-18T22:12:19.000007Z

@cvermilion: Alternatively, you can fairly easily make an equivalent of (slurp *in*) in Planck 1.15 based on read-line:

(ns foo.core
  (:require [clojure.string :as string]
            [planck.core :refer [read-line]]))

(defn slurp-in []
  (let [lines (atom [])]
    (loop [line (read-line)]
      (when line
        (swap! lines conj line)
        (recur (read-line))))
    (string/join "\n" @lines)))

(-&gt; (slurp-in)
  count
  println)

cvermilion 2016-07-18T23:56:12.000008Z

@mfikes: nice — thanks!