This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-07-18
Channels
- # admin-announcements (3)
- # alda (1)
- # boot (85)
- # capetown (4)
- # cider (10)
- # clara (16)
- # cljsrn (3)
- # clojars (35)
- # clojure (83)
- # clojure-austin (8)
- # clojure-brasil (4)
- # clojure-canada (16)
- # clojure-greece (2)
- # clojure-ireland (7)
- # clojure-russia (23)
- # clojure-spec (22)
- # clojure-uk (151)
- # clojurescript (97)
- # core-async (10)
- # cursive (1)
- # datascript (7)
- # datomic (21)
- # defnpodcast (13)
- # devcards (3)
- # emacs (4)
- # events (3)
- # hoplon (18)
- # juxt (4)
- # leiningen (7)
- # mount (4)
- # off-topic (2)
- # om (1)
- # onyx (30)
- # planck (6)
- # proton (81)
- # re-frame (3)
- # reagent (9)
- # rum (10)
- # spacemacs (1)
- # specter (6)
- # testing (7)
- # untangled (66)
- # vim (84)
- # yada (23)
@mfikes — a suggestion: it would be nice for scripting to have something like (slurp *in*)
@cvermilion: Seems like a reasonable thing to do. If you can brew
HEAD
I dropped some code supporting that in master.
Here is an example:
$ cat foo.cljs
(ns foo.core
(:require [planck.core :refer [slurp *in*]]
[]))
(-> (slurp *in*)
count
println)
$ wc foo.cljs
7 13 122 foo.cljs
$ planck foo.cljs < foo.cljs
122
If you decide to brew
HEAD
, note the bit about brew edit planck
at http://planck-repl.org/setup.html
@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)))
(-> (slurp-in)
count
println)
@mfikes: nice — thanks!