Back

io-prepl (clj)

(source)

function

(io-prepl & {:keys [valf], :or {valf pr-str}})
prepl bound to *in* and *out*, suitable for use with e.g. server/repl (socket-repl). :ret and :tap vals will be processed by valf, a fn of one argument or a symbol naming same (default pr-str) Alpha, subject to change.

Examples

babashka/babashka
(ns babashka.impl.server
  (:require [babashka.impl.clojure.core.server :as server]
            [babashka.impl.common :as common]
            [babashka.impl.socket-repl :as socket-repl]
            [sci.core :as sci]))

(def io-prepl
  (fn [& args]
    (apply server/io-prepl (common/ctx) args)))

(def clojure-core-server-namespace
  {'repl (sci/copy-var socket-repl/repl sns)
   'prepl (sci/copy-var prepl sns)
   'io-prepl (sci/copy-var io-prepl sns)
   'start-server (sci/copy-var start-server sns)
   'stop-server (sci/copy-var server/stop-server sns)})