Created
August 2, 2015 19:04
-
-
Save hby/52d698ca4b2a69ab7ee6 to your computer and use it in GitHub Desktop.
planck try #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ hby@Guardian ~/dev/ClojureScript/mac-command-line/planck-demo ] ls | |
script.cljs unsorted.txt | |
[ hby@Guardian ~/dev/ClojureScript/mac-command-line/planck-demo ] cat script.cljs | |
#! /Users/hby/bin/planck | |
(->> | |
(slurp "unsorted.txt") | |
(re-seq #"\w+") | |
sort | |
(#(interleave %1 (cycle "\n"))) | |
(apply str) | |
(spit "sorted.txt")) | |
[ hby@Guardian ~/dev/ClojureScript/mac-command-line/planck-demo ] ./script.cljs | |
WARNING: Use of undeclared Var cljs.user/spit at line 9 | |
WARNING: Use of undeclared Var cljs.user/slurp at line 4 | |
undefined is not an object (evaluating 'cljs.user.spit.call') | |
eval code | |
eval@[native code] | |
cljs$js$js_eval@file:///cljs/js.js:124:12 | |
file:///cljs/js.js:1578:347 | |
file:///cljs/js.js:1581:4 | |
cljs$js$eval_str_STAR__$_compile_loop@file:///cljs/js.js:1591:16 | |
cljs$js$eval_str_STAR_@file:///cljs/js.js:1609:6 | |
cljs$core$IFn$_invoke$arity$5@file:///cljs/js.js:1712:30 | |
cljs$core$IFn$_invoke$arity$2@file:///planck/core.js:267:58 | |
planck$core$read_eval_print@file:///planck/core.js:193:65 | |
[ hby@Guardian ~/dev/ClojureScript/mac-command-line/planck-demo ] |
Great, it works! I'm inspired to play. Thanks, again.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In the very first version I had "cheated" by making
spit
andslurp
be REPL specials. While this worked, now withcljs.js
it is easy to have proper namespace support, etc. and these are now first-class functions in a namespace. Depending on how this all goes, I may end up considering referring them intocljs.user
, but it is not clear to me yet. So for now, just use them from theirplanck.io
namespace: