2014-07-09 9:39 GMT+02:00 Cecil Westerhof <cldwester...@gmail.com>:

> Or you could use a definition of look more like this, which uses println
>
>> to print each item on its own line (not sure if you wanted to retain the
>> parens or not, but both are easily doable).
>>
>>     (defn look []
>>       (doseq [d [(describe-location *location* nodes)
>>                  (describe-paths *location* edges)
>>                  (describe-objects *location* objects
>> *object-locations*)]]
>>         (println d)))
>>
>
> ​That certainly looks better. The only problem is that the lines of the
> different calls are still printed as one. But rewriting to use strings
> would solve that problem. I just have to finish the book, to see if I can
> change the lists to strings.​
>
>

​Solved it without reverting to stings. See attachment. The only 'problem'
are the parentheses. How to get rid of those?

​


> > - 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?
>>
>> The "earmuffs" convention is related to dynamic variables. All global
>> variables are dynamic in Common Lisp, but that's not the case in
>> Clojure. You're creating dynamic variables (by using :dynamic metadata
>> in your defs) but I didn't notice anywhere where you're using this
>> feature (i.e. no binding or set! forms). Long story short, I would use
>> earmuffs if the variables are dynamic but not otherwise.
>>
>
> ​I read a little about it. And no, I do not use dynamic binding. So I
> probably should use atoms. Is there a convention how to name atoms?​
>

​Got also rid of the dynamic variables.

-- 
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.

Attachment: land-of-lisp-text-game.clj
Description: Binary data

Reply via email to