Re: casting spels in clojure problem

2011-12-12 Thread Kevin Ilchmann Jørgensen
If this is your code: http://www.lisperati.com/clojure-spels/code.html

Then  (spel-print (describe-paths 'living-room game-map)) will work.

spel-print takes a list that is returned from describe-paths.

/Kevin

On Mon, Dec 12, 2011 at 7:51 AM, jayvandal s...@ida.net wrote:
 I am trying castin spels in clojure and I get this error. What does it
 mean??


 user= (spel-print describe-paths 'living-room game-map)
 java.lang.IllegalArgumentException: Wrong number of args (3) passed
 to: user$spel-print (NO_SOURCE_FILE:0)
 ==
 code is

                                   snoring loudly on the couch -)
                              (west door garden)
                              (upstairs stairway attic))
               'garden '((you are in a beautiful garden -
                              there is a well in front of you -)
                         (east door living-room))
               'attic '((you are in the attic of the
                             wizards house - there is a giant
                             welding torch in the corner -)
                        (downstairs stairway living-room
 ;; Object locations in a hash map
 (def object-locations (hash-map
                       'whiskey-bottle 'living-room
                       'bucket 'living-room
                       'chain 'garden
                       'frog 'garden))
 (def location 'living-room)
 (defn describe-location [location game-map]
  (first (location game-map)))
 ;; in clojure backquote mode, the ~ escapes the mode instead of the
 comma
 (defn describe-path [path]
  `(there is a ~(second path) going ~(first path) from here -))
 (defn describe-paths [location game-map]
  (apply concat (map describe-path (rest (get game-map location)
 (defn is-at? [obj loc obj-loc] (= (obj obj-loc) loc))

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


casting spels in clojure problem

2011-12-11 Thread jayvandal
I am trying castin spels in clojure and I get this error. What does it
mean??


user= (spel-print describe-paths 'living-room game-map)
java.lang.IllegalArgumentException: Wrong number of args (3) passed
to: user$spel-print (NO_SOURCE_FILE:0)
==
code is

   snoring loudly on the couch -)
  (west door garden)
  (upstairs stairway attic))
   'garden '((you are in a beautiful garden -
  there is a well in front of you -)
 (east door living-room))
   'attic '((you are in the attic of the
 wizards house - there is a giant
 welding torch in the corner -)
(downstairs stairway living-room
;; Object locations in a hash map
(def object-locations (hash-map
   'whiskey-bottle 'living-room
   'bucket 'living-room
   'chain 'garden
   'frog 'garden))
(def location 'living-room)
(defn describe-location [location game-map]
  (first (location game-map)))
;; in clojure backquote mode, the ~ escapes the mode instead of the
comma
(defn describe-path [path]
  `(there is a ~(second path) going ~(first path) from here -))
(defn describe-paths [location game-map]
  (apply concat (map describe-path (rest (get game-map location)
(defn is-at? [obj loc obj-loc] (= (obj obj-loc) loc))

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


Re: casting spels in clojure problem

2011-12-11 Thread Stuart Campbell
Hello,

You'll need to include the source of the spel-print function, i.e. the
(defn spel-print ...) part of the code.

The error means that you're calling spel-print with either too many or too
few arguments. But we can't tell unless you provide the code for that
function :)

Regards,
Stuart

On 12 December 2011 17:51, jayvandal s...@ida.net wrote:

 I am trying castin spels in clojure and I get this error. What does it
 mean??


 user= (spel-print describe-paths 'living-room game-map)
 java.lang.IllegalArgumentException: Wrong number of args (3) passed
 to: user$spel-print (NO_SOURCE_FILE:0)
 ==
 code is

   snoring loudly on the couch -)
  (west door garden)
  (upstairs stairway attic))
   'garden '((you are in a beautiful garden -
  there is a well in front of you -)
 (east door living-room))
   'attic '((you are in the attic of the
 wizards house - there is a giant
 welding torch in the corner -)
(downstairs stairway living-room
 ;; Object locations in a hash map
 (def object-locations (hash-map
   'whiskey-bottle 'living-room
   'bucket 'living-room
   'chain 'garden
   'frog 'garden))
 (def location 'living-room)
 (defn describe-location [location game-map]
  (first (location game-map)))
 ;; in clojure backquote mode, the ~ escapes the mode instead of the
 comma
 (defn describe-path [path]
  `(there is a ~(second path) going ~(first path) from here -))
 (defn describe-paths [location game-map]
  (apply concat (map describe-path (rest (get game-map location)
 (defn is-at? [obj loc obj-loc] (= (obj obj-loc) loc))

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