Arc Forumnew | comments | leaders | submitlogin
2 points by aw 4643 days ago | link | parent

This just gave me an idea... x!first translates into (x 'first), which for a list in arc3 expects an integer so that it can return the item in the list at that position. But this means that non-number arguments to calling a list is available: currently we get an error that the argument is not an integer. So if the argument isn't a number, calling a list could do an association list lookup instead. Thus:

  arc> x!first
  "First Name"

  arc> x!0
  (first "First Name")
as Arc does now.

The difference with your syntax is that with your syntax we could use integers as association list keys.

I'm interesting in this topic because in many places in my code where I'm using tables, I'm using tables for the convenience of the x!first syntax, not because I have a large number of keys and values that I'd need the efficiency of a hash table for.