At at¶
Returns the element at the specified index or key from a collection.
Syntax¶
Examples¶
Vector/List Indexing¶
Dictionary Access¶
Table Column Access¶
↪ (set at_t (table [name age] (list (list "Alice" "Bob") [25 30])))
↪ (at at_t 'name)
(
Alice
Bob
)
↪ (at at_t 'age)
[25 30]
Reserved Word Columns (CRITICAL)¶
When a table column name matches a RayFall built-in function (like timestamp, type, count), you MUST use (at table 'column) to access it:
;; Create table with 'timestamp' column (reserved word)
↪ (set trades (table [timestamp price amount] (list [1000 2000 3000] [100.5 101.0 99.5] [10 20 15])))
;; WRONG - timestamp is a built-in function
;; (select {ts: timestamp from: trades}) ;; ERROR!
;; CORRECT - use at with quoted symbol
↪ (select {ts: (at trades 'timestamp) from: trades})
Reserved Word Columns
The following column names conflict with built-in functions and require (at table 'column) syntax:
timestamp- temporal functiontype- type inspectioncount- counting functiondate,time- temporal functionsfirst,last- item accesssum,avg,min,max- aggregationskey,value- dictionary accesswhere,group- query clausesdistinct,reverse- collection operations
Parameters
- collection: Vector, list, dictionary, or table
- index/key: Integer index (0-based) or quoted symbol for key access
Tip
Use at for:
- Accessing elements by position in vectors/lists
- Looking up values by key in dictionaries
- Extracting columns from tables, especially reserved-word columns