next up previous contents index
Next: 1.6.1 Efficiency issues Up: 1. Onyx Language Tutorial Previous: 1.5.3 Efficiency issues   Contents   Index

1.6 Dictionaries

Dictionaries are known by various other names, including hashes and associative arrays. Dictionaries in Onyx associate keys with values. Keys and values can be of any type, but for each dictionary, all keys are unique. For example, the following dictionary cannot exist:

<
    42 `Some value'
    42 `Another value'
>

To demonstrate this, the following example creates a dictionary with the first key/value pair listed above, then inserts the second key/value pair.

onyx:0> <42 `Some value'>
onyx:1> dup 1 sprint
<42 `Some value'>
onyx:1> dup 42 `Another value' put
onyx:1> dup 1 sprint
<42 `Another value'>
onyx:1>

When the second key/value pair is inserted, it replaces the first pair.



Subsections

Jason Evans 2003-01-31