dotsym.zy 462 B

12345678910111213141516171819202122232425
  1. // dotsymbols: no longer special
  2. // (def) on a dot-symbol is illegal
  3. (def a 9)
  4. //(def .a 3)
  5. (assert (== .a %.a))
  6. (assert (== a 9))
  7. //
  8. // nested paths of dot-symbols work
  9. //
  10. (def s (snoopy asst: (hornet sidekick: (hellcat fname:"henry" lname:"johnson"))))
  11. // get
  12. (assert (== s.asst.sidekick.fname "henry"))
  13. // assign
  14. {s.asst.sidekick.lname = "smith"}
  15. (assert (== s.asst.sidekick.lname "smith"))
  16. // without leading .
  17. (def h (hash a:10))
  18. (assert (== h.a 10))