Hi,
you could do it in a way counterclockwise does. You can implement a
repl that listening at an arbitrary port like doing this:
(ns de.svenali.education.inES.tools.repl
(:require clojure.main)
(:import (java.io InputStreamReader PrintWriter)
(java.net ServerSocket Socket)
(clojure.lang LineNumberingPushbackReader))
(:gen-class
)
)
(defn do-on-thread
Create a new thread and run function f on it. Returns the thread
object that
was created.
[f]
(let [thread (new Thread f)]
(.start thread)
thread))
(defn socket-repl
Start a new REPL that is connected to the input/output streams of
socket.
[socket]
(let [socket-in (new LineNumberingPushbackReader
(new InputStreamReader
(.getInputStream socket)))
socket-out (new PrintWriter
(.getOutputStream socket) true)]
(binding [*in* socket-in
*out* socket-out
*err* socket-out]
(clojure.main/repl
(defn start-repl-server
Creates a new thread and starts a REPL server on listening on
port. Returns
the server socket that was just created.
[port]
(let [server-socket (new ServerSocket port 0)]
(do-on-thread #(while true (socket-repl (.accept server-
socket
server-socket))
You have to start this in your swing app. Then you can connect with
standard java sockets to this repl.
regards,
Sven
On 28 Nov., 22:56, Stuart Sierra the.stuart.sie...@gmail.com wrote:
You can certainly run a REPL in a Swing GUI app. I'm not aware of any
standalone Swing widgets to do this, but you could look at Clooj for
an example:https://github.com/arthuredelstein/clooj
-Stuart Sierra
clojure.com
--
You received this message because you are subscribed to the Google
Groups Clojure group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en