A typed thing is a thing with predefined properties and/or methods with are defined by a Type. When creating a typed thing, all defined properties of the Type are guaranteed to exist with a value matching the type definition.
Most, but not all, functions of a thing work on typed things as well. Next to the functions below, a typed thing may have additional methods which are defined by the Type.
| Function | Description |
|---|---|
| assign | Copies properties from a typed thing. |
| copy | Copy a typed thing as a new thing. The Type is not preserved. |
| dup | Duplicate a typed thing while preserving the Type. |
| each | Iterate over all properties of a typed thing. |
| equals | Test if two things are equal. |
| filter | Return a new thing with properties that pass a given test. |
| get | Return the value of a property on a typed thing by a given property name. |
| has | Determine if a typed thing has a given property. |
| id | Return id of the typed thing or nil when the typed thing is not stored. |
| keys | Return a list with all the property names of a typed thing. |
| len | Return the number of items. |
| map | Return a list with the results of calling a provided closure on every property. |
| set | Set a property of a typed thing to a new value. |
| values | Return a list with all the property values of a typed thing. |
| vmap | Returns a new thing with equal keys but values as a result of a given closure. |
| to_thing | Converts a typed thing to a non-typed thing. |
| wrap | Wrap the typed thing with a Type. |
Most of the above functions correspond to those of a thing. For that reason, they are only listed under the data type thing.