(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 father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.
+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.
Incidentally, I was able to pull in the SableCC library and use my custom language on top of the repl, exactly as you describe. The lexer (waiting for user input) was using a PushbackReader. But I imagine you can use anything that does a blocked read on stdin.
But in the end, I realised that a few custom Clojure functions and macros pretty much covered what my DSL was doing. So now my "shell" is just a namespace inside of a repl.
HTH
Tim
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@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+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en