Re: implement a shell in repl

2011-09-21 Thread Timothy Washington
+1. My project has a shell on top of a repl, which is just load in a different namespace and associated functions and macros. This assumes that your shell language is an extension of Clojure / LISP, which is certainly the path I chose. I replaced a customed DSL I designed in Java, using SableCC.

Re: implement a shell in repl

2011-09-20 Thread jaime
This may not work the way I want...but yes I will give it a shot. :-) On Sep 21, 2:08 am, Ken Wesson wrote: > Wouldn't the simplest way be to simply use the REPL itself as the > shell, with a few things defined like this? > > (def dir (atom (System/getProperty "user.home"))) > > (defn pwd [] @dir

Re: implement a shell in repl

2011-09-20 Thread jaime
Good point. I think I need to find out how to make the "shell" prompt for user input, e.g. when the user log into a system, the shell will prompt to ask for a password On Sep 20, 4:03 pm, Sanel Zukan wrote: > I had quite similar task, integrating custom shell with clojure repl, > where all ex

Re: implement a shell in repl

2011-09-20 Thread Ken Wesson
Wouldn't the simplest way be to simply use the REPL itself as the shell, with a few things defined like this? (def dir (atom (System/getProperty "user.home"))) (defn pwd [] @dir) (defn cd [dir] (reset! @dir dir)) (defn ... ) -- Protege: What is this seething mass of parentheses?! Master: Your

Re: implement a shell in repl

2011-09-20 Thread Sanel Zukan
I had quite similar task, integrating custom shell with clojure repl, where all expressions between parenthesis were interpreted as clojure code and rest as custom shell programs. The best way to do this is to explore (clojure.main/repl) function. One of the parameters will be :eval function; ther

implement a shell in repl

2011-09-20 Thread jaime
Hi guys, I want to implement a shell on top of REPL but without any ideas on how to do it. Could you please suggest? What I want is something that can let user do things like: 1. in REPL, user enter "(myshell)" (or some other command name) 2. then a prompt string will show up so that user