You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

dynamic-lookups.l2 397B

123456789101112131415161718192021
  1. # Lookup array values dynamically
  2. idx := 0
  3. arr := [100 20 30]
  4. print arr.(idx)
  5. # More complex expressions in the subscript operation
  6. arr.(+ idx 1) = 50
  7. print arr
  8. # Lookup into a temporary
  9. print [10 20 30].(+ 1 1)
  10. # Lookup into a namespace by atom
  11. obj := {}
  12. obj.('hello) = "what's up"
  13. print obj.hello
  14. # More complicated expression again
  15. get-ident := {'foo}
  16. obj.(get-ident()) = 100
  17. print obj.foo