Re: Embedding a REPL

2009-12-09 Thread Mike
Hey thanks to everyone who replied to this thread; I appreciate all the ideas. I managed to get my version working by closing *in*...but I had to use my own code to start the repl, because main uses code that calls System/exit after the repl completes (bad). It turns out my (our...I didn't do

Re: Embedding a REPL

2009-12-08 Thread Oliver Kaiser
Have you seen this post: http://ianp.org/2009/04/embedding-clojure-part-2/ ? I haven't tried this, but it looks like what you are asking. Regards, tok -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Embedding a REPL

2009-12-08 Thread Mike
I tried this approach, and it works great. I had to spin the call to main.main() in another thread, but that's expected. What I didn't expect is that when I try to close the LineNumberingPushbackReader (to end the repl), I get infinite exceptions: java.io.IOException: Stream closed

Re: Embedding a REPL

2009-12-08 Thread Albert Cardona
On Mon, Dec 7, 2009 at 11:19 AM, Mike cki...@gmail.com wrote: My app has its own JPanel for display results, and a text area for input, so I'll need to start repl with some replacement callback functions (read, print, prompt, need-prompt).  I'd like to code as much as possible in Clojure, but

Re: Embedding a REPL

2009-12-08 Thread Liam
Close the *out* stream, not the *in*. That should do it. (. *out* close) It was fun watching that the first time it happend to me. ;-) On Dec 8, 11:26 am, Mike cki...@gmail.com wrote: I tried this approach, and it works great.  I had to spin the call to main.main() in another thread, but

Embedding a REPL

2009-12-07 Thread Mike
I've seen an example of launching a Clojure script from Java (http:// en.wikibooks.org/wiki/Clojure_Programming/ Tutorials_and_Tips#Invoking_Clojure_from_Java), but I've got an application in which I'd like to run a REPL. My app has its own JPanel for display results, and a text area for input,

Re: Embedding a REPL

2009-12-07 Thread Liam
I think the following is “looked down upon” or “discouraged“, but I managed to sift through how clojure itself handles its own stuff in java and I came up with the following. Say, that you want to set *out*, *in*, and *err* in clojure to something from Java before starting a REPL. Here is how I