Re: Writing a generic function for getting any value for a key

2011-03-05 Thread Ken Wesson
On Sat, Mar 5, 2011 at 3:37 AM, Alan wrote: > Yeah, thanks for the reminder Ken. It's easy to assume people can just > go look at SO to see the relevant question, but we're curating a sort > of archive here as well so it's good to have a permanent link. Also, after a while the SO thread would be

Re: Writing a generic function for getting any value for a key

2011-03-05 Thread Alan
Yeah, thanks for the reminder Ken. It's easy to assume people can just go look at SO to see the relevant question, but we're curating a sort of archive here as well so it's good to have a permanent link. On Mar 4, 7:55 pm, Ken Wesson wrote: > On Fri, Mar 4, 2011 at 10:07 PM, HB wrote: > > Sorry,

Re: Writing a generic function for getting any value for a key

2011-03-04 Thread Ken Wesson
On Fri, Mar 4, 2011 at 10:07 PM, HB wrote: > Sorry, my mistake. > I will do this in the future, sorry for any inconvenience that may > happened. Oh I wasn't accusing anyone of a mistake, just asking for the link (or the actual solution) to be posted for the benefit of readers of this list (or sea

Re: Writing a generic function for getting any value for a key

2011-03-04 Thread HB
Sorry, my mistake. I will do this in the future, sorry for any inconvenience that may happened. On Mar 5, 3:54 am, Ken Wesson wrote: > On Fri, Mar 4, 2011 at 8:25 PM, HB wrote: > > On Mar 5, 3:05 am, Alan wrote: > >> Does my answer to your StackOverflow question also resolve this issue? > > Yes

Re: Writing a generic function for getting any value for a key

2011-03-04 Thread Alan
For those who don't like clicking on links: his program had too many parentheses, but it worked in the REPL because he was typing different code. On Mar 4, 6:41 pm, Alan wrote: > http://stackoverflow.com/questions/5200169/code-run-in-repl-but-not-i... > > On Mar 4, 5:54 pm, Ken Wesson wrote: > >

Re: Writing a generic function for getting any value for a key

2011-03-04 Thread Alan
http://stackoverflow.com/questions/5200169/code-run-in-repl-but-not-if-saved-to-a-file/5200885#5200885 On Mar 4, 5:54 pm, Ken Wesson wrote: > On Fri, Mar 4, 2011 at 8:25 PM, HB wrote: > > On Mar 5, 3:05 am, Alan wrote: > >> Does my answer to your StackOverflow question also resolve this issue?

Re: Writing a generic function for getting any value for a key

2011-03-04 Thread Ken Wesson
On Fri, Mar 4, 2011 at 8:25 PM, HB wrote: > On Mar 5, 3:05 am, Alan wrote: >> Does my answer to your StackOverflow question also resolve this issue? > Yes, it did and I was about resolving this post. > Thanks. > The issue is solved guys, thank you all for passing. Please post either the solution

Re: Writing a generic function for getting any value for a key

2011-03-04 Thread HB
Yes, it did and I was about resolving this post. Thanks. The issue is solved guys, thank you all for passing. On Mar 5, 3:05 am, Alan wrote: > On Mar 4, 4:53 pm, HB wrote: > > > > > > > Here is the file:http://dl.dropbox.com/u/3630641/wizard-game.clj > > > On Mar 4, 4:24 am, HB wrote: > > > > S

Re: Writing a generic function for getting any value for a key

2011-03-04 Thread Alan
On Mar 4, 4:53 pm, HB wrote: > Here is the file:http://dl.dropbox.com/u/3630641/wizard-game.clj > > On Mar 4, 4:24 am, HB wrote: > > > > > > > > > Sorry, it is: > > > Exception in thread "main" java.lang.IllegalArgumentException: Wrong > > number of args (1) passed to: user$describe-place (wizard

Re: Writing a generic function for getting any value for a key

2011-03-04 Thread HB
Here is the file: http://dl.dropbox.com/u/3630641/wizard-game.clj On Mar 4, 4:24 am, HB wrote: > Sorry, it is: > > Exception in thread "main" java.lang.IllegalArgumentException: Wrong > number of args (1) passed to: user$describe-place (wizard-game.clj: > 0) > > On Mar 4, 4:12 am, HB wrote: > >

Re: Writing a generic function for getting any value for a key

2011-03-03 Thread HB
Sorry, it is: Exception in thread "main" java.lang.IllegalArgumentException: Wrong number of args (1) passed to: user$describe-place (wizard-game.clj: 0) On Mar 4, 4:12 am, HB wrote: > Yes indeed, it runs on my REPL too! > However, if I save the code to a file and try to run it, I got this > exc

Re: Writing a generic function for getting any value for a key

2011-03-03 Thread HB
Yes indeed, it runs on my REPL too! However, if I save the code to a file and try to run it, I got this exception: Exception in thread "main" java.lang.IllegalArgumentException: Wrong number of args (1) passed to: user$describe-location (wizard-game.clj: 0) On Mar 4, 3:59 am, Alan wrote: > Copi

Re: Writing a generic function for getting any value for a key

2011-03-03 Thread .Bill Smith
I'm not sure what you want describe-place to do, but you don't need a new function to get the value for a key of a map. user=> (def *places* {:room "Nice room" :basement "what ever"}) #'user/*places* user=> (:room *places*) "Nice room" user=> (*places* :room) "Nice room" user=> (:basement *place

Re: Writing a generic function for getting any value for a key

2011-03-03 Thread Alan
Copied and pasted straight from your post to my REPL it works fine. Maybe verify that you're actually doing what you think you're doing? That said, this function already exists: it's called get. user=> (def *places* {:room "Nice room" :basement "what ever"}) #'user/*pla

Re: Writing a generic function for getting any value for a key

2011-03-03 Thread Ken Wesson
On Thu, Mar 3, 2011 at 8:33 PM, HB wrote: > Hi, > > I'm trying to write a function that gets the value for a key of a map. > > (def *places* {:room "Nice room" >                    :basement "what ever"}) > > (defn describe-place [place places] >   (places place)) > > (describe-place :room *places

Writing a generic function for getting any value for a key

2011-03-03 Thread HB
Hi, I'm trying to write a function that gets the value for a key of a map. (def *places* {:room "Nice room" :basement "what ever"}) (defn describe-place [place places] (places place)) (describe-place :room *places*) Of course it isn't running :) What should I do? Thanks