Arc Forumnew | comments | leaders | submitlogin
2 points by evanrmurphy 5350 days ago | link | parent

In your table, both the keys are symbols, which need the quote for reference. You can use dot ssyntax to retrieve vals for any keys that are numbers (since numbers don't need quote):

  arc> (= a (obj 1 "one" 2 "two"))
  #hash((1 . "one") (2 . "two"))
  arc> a.1
  "one"
  arc> a.2
  "two"
For keys of other types that don't need quote, like char and string, you can't use dot ssyntax directly:

  arc> (= a (obj #\a "char a" "b" "string b"))
  #hash((#\a . "char a") ("b" . "string b"))
  arc> a.#\a
  Error: "UNKNOWN::0: read: bad syntax `#a'"
  arc> a."b"
  Error: "Bad ssyntax a."
  arc> "b"

But you can use it if you go through a variable:

  arc> (let ch #\a
         a.ch)
  "char a"
  arc> (let s "b"
         a.s)
  "string b"