To recap, we’ve discussed how Step executes calls to tasks — both predicates and non-predicates — by matching the parameters specified in the call to the parameters for the different methods of the task. It tries a method when it can match each parameter in the call to its respective parameter in the method.
Thus far, all the values that have been passed along for parameters have been single pieces of data: a text string, a variable, maybe a number. But there are times when we want to pass something more complicated as the value of a parameter. In effect, we want to package several data objects together as a single data object. Step has two versions of these, tuples and feature structures. We'll talk about each of these and give examples.
Technical: comparison to other languages
If you're an experienced programmer, then the way to think about Step data structures is they're like JSON objects that:
- Use spaces instead of commas as separators
- Can have variables inside of them
- Can be matched to other objects, binding variables in the process
Tuples in Step function like tuples in Python or arrays in C, C# or JavaScript: they're ordered sequences of objects. They're notated similarly to JavaScript syntax, except you use spaces as separators instead of commas.
Although they originally come from linguistics, feature structures are dictionaries, similar to the Python dict
type or Javascript
objects. That is, they're unordered collections of key/value pairs. Syntactically, they look like JSON notation, but again, with spaces as separators rather than commas.