init
This commit is contained in:
commit
90f92d4c66
20 changed files with 425 additions and 0 deletions
16
bin/bbrep
Executable file
16
bin/bbrep
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env bb
|
||||
;; Based on:
|
||||
;; https://book.babashka.org/#_interacting_with_an_nrepl_server
|
||||
(ns nrepl-client
|
||||
(:require [bencode.core :as b]))
|
||||
|
||||
(defn nrepl-eval [port expr]
|
||||
(println (clojure.string/trim expr))
|
||||
(let [s (java.net.Socket. "localhost" port)
|
||||
out (.getOutputStream s)
|
||||
in (java.io.PushbackInputStream. (.getInputStream s))
|
||||
_ (b/write-bencode out {"op" "eval" "code" expr})
|
||||
bytes (get (b/read-bencode in) "value")]
|
||||
(println ";;" (String. bytes))))
|
||||
|
||||
(nrepl-eval 1667 (slurp *in*))
|
Loading…
Add table
Add a link
Reference in a new issue