Re: How to access record in a hashmap

2014-07-09 Thread Cecil Westerhof
2014-07-09 17:50 GMT+02:00 Cecil Westerhof : > 2014-07-09 17:32 GMT+02:00 Timothy Baldridge : > > (name :foo) >> >> will return the name as a string >> >> (symbol (name :foo)) >> >> Converts the name of the keyword to a symbol >> > > ​It is not even necessary. I changed to keywords. The code uses:

Re: How to access record in a hashmap

2014-07-09 Thread Cecil Westerhof
2014-07-09 17:32 GMT+02:00 Timothy Baldridge : > (name :foo) > > will return the name as a string > > (symbol (name :foo)) > > Converts the name of the keyword to a symbol > ​It is not even necessary. I changed to keywords. The code uses: `(You see a ~obj on the floor.) And it is displayed a

Re: How to access record in a hashmap

2014-07-09 Thread Thomas Heller
Don't know Land of Lisp, but if you print it you can use (name :whiskey) to get "whiskey" (as a String), also works on (name 'whiskey). On Wed, Jul 9, 2014 at 5:28 PM, Cecil Westerhof wrote: > 2014-07-09 17:18 GMT+02:00 Thomas Heller : > > Oh and its rare (outside of macros) to use symbols like

Re: How to access record in a hashmap

2014-07-09 Thread Timothy Baldridge
(name :foo) will return the name as a string (symbol (name :foo)) Converts the name of the keyword to a symbol On Wed, Jul 9, 2014 at 9:28 AM, Cecil Westerhof wrote: > 2014-07-09 17:18 GMT+02:00 Thomas Heller : > > Oh and its rare (outside of macros) to use symbols like that. Usually >> you'

Re: How to access record in a hashmap

2014-07-09 Thread Cecil Westerhof
2014-07-09 17:18 GMT+02:00 Thomas Heller : > Oh and its rare (outside of macros) to use symbols like that. Usually > you'd use keywords. > > (def object-locations > {:whiskey :living-room}) > ​It is from 'Land of Lisp'. The symbols are printed. Or is it possible to print the keyword without the

Re: How to access record in a hashmap

2014-07-09 Thread Cecil Westerhof
2014-07-09 17:03 GMT+02:00 Thomas Heller : > Short and simple answer: NullPointerException > > (def object-locations nil) > > (object-locations 'bucket) will throw > ('bucket object-locations) => nil > ​That is interesting.​ ​Not a problem, because it will never be ​nil, but always a HashMap. Bu

Re: How to access record in a hashmap

2014-07-09 Thread Thomas Heller
Oh and its rare (outside of macros) to use symbols like that. Usually you'd use keywords. (def object-locations {:whiskey :living-room}) On Wed, Jul 9, 2014 at 5:03 PM, Thomas Heller wrote: > Short and simple answer: NullPointerException > > (def object-locations nil) > > (object-locations '

Re: How to access record in a hashmap

2014-07-09 Thread Thomas Heller
Short and simple answer: NullPointerException (def object-locations nil) (object-locations 'bucket) will throw ('bucket object-locations) => nil HTH, /thomas On Wednesday, July 9, 2014 3:48:53 PM UTC+2, Cecil Westerhof wrote: > > When you have: > (def object-locations { > 'whiskey 'livin

How to access record in a hashmap

2014-07-09 Thread Cecil Westerhof
When you have: (def object-locations { 'whiskey 'living-room 'bucket'living-room 'chain 'garden 'frog 'garden 'dummy 'nowhere 'test 'nowhere }) You can retrieve the location of the bucket with: (object-locations 'bucket) and with: