The essential functions in Clojure are similar - read, print, and eval all
exist although you'll probably want println to get the newline in there.
Because Clojure does not automatically do tail recursion, you'll want to
use "loop"/"recur".
Putting it all together:
(defn repl []
(loop []
(println (eval (read)))
(recur)))
On Monday, January 23, 2017 at 7:46:59 PM UTC-6, Lance Campbell wrote:
>
> In Land of Lisp, a game REPL interface (or any REPL interface) is defined
> in Common Lisp as:
>
> (defun game-repl ()
> (loop (print (eval (read)))))
>
> and it works.
>
> In Clojure, it fails.
>
> What is the simple and elegant Clojure solution for the REPL interface?
>
> Thanks for your time, ahead of time.
>
> Lance.
>
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.