A few notes:

Prefer vectors over quoted lists '(1 2) vs [1 2]. There's rarely a case
(outside of macros) that you want the former.

Instead of quoted lists of symbols: '(You cannot get that.) try strings
"You cannot get that"

Don't use defs inside defs. Instead move the defs to a global position and
then use binding or set-var-root! to set them. Better yet, use atoms to
hold their contents, even better yet, pass the game state into each
function and have each function return a new game state.

Instead of:

(defn walk [direction]
  ...
  (def ^:dynamic *location* (first edge))

Use atoms like this:

(def location (atom nil))

(defn walk [direction]
  ...
  (reset! location (first edge))


Once you replace symbol lists with strings, you can easily do this instead
of syntax quoting:

(str "There is a " (nth edge 2) " going " (nth edge 1) "from here")



That's all I have for now.

Timothy



On Tue, Jul 8, 2014 at 6:24 PM, Bruce Wang <br...@brucewang.net> wrote:

> Hi Cecil,
>
> You might want to check out this
> https://github.com/quux00/land-of-lisp-in-clojure
>
> Cheers,
> Bruce
>
>
> On Wed, Jul 9, 2014 at 9:49 AM, Cecil Westerhof <cldwester...@gmail.com>
> wrote:
>
>> I received the book land of lisp as a gift. I am trying to translate it
>> to Clojure. In chapter 5 there is a text game engine. In the attachment my
>> translation. What do you think of it?
>>
>> There are a few problems.
>> - The book displays all the lines of a look on separate lines. In my case
>> it is just one long line. Am I doing something wrong?
>>
>> - In Emacs Lisp you can use a function A in the definition of another
>> function B before you declared function A. Is it correct that this is not
>> possible in Clojure?
>>
>> - Al variables in land of lisp begin and end with an asterisk. As I
>> understood it, you only do this for variables that can be changed. So I
>> renamed some variables. Did I understand this correctly, or is the usage of
>> asterisks for something else?
>>
>> --
>> Cecil Westerhof
>>
>> --
>> 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
>> ---
>> 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 clojure+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> simple is good
> http://brucewang.net
> http://twitter.com/number5
>
> --
> 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
> ---
> 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 clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
“One of the main causes of the fall of the Roman Empire was that–lacking
zero–they had no way to indicate successful termination of their C
programs.”
(Robert Firth)

-- 
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
--- 
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to