Objects & Arrays

When you need to describe more than a single value.

Object

SEL is handy for working with, parsing, and composing JSON objects, a common need for coders and no-coders alike. Here is how we can define a JSON object:

=Object({"attr": 1, "bar": [1, 2, 3]})

As you can see, these objects can be of any depth or complexity, as long as they are JSON-compliant in terms of syntax.

An Object event will send the object it contains downstream. This makes it an upstream complement to Parser.

The most common use of Object in SEL is defining params, headers, etc. to pass to a Request, or options to pass to AI events.

Array

Sometimes you want to store a static list of items. For this, we use Array:

=Array([1,2,3])

Since an array can contain a mix of numbers or strings, the array event reports its length to the ledger. The above array would report 3, and so would this:

=Array([1, 'otter', 'cute'])

And this:

=Array(['sweet', 'home', 'alabama'])

Matrix Math

In addition to holding lists of input values, arrays are especially useful for matrix math.

Fun with vectors!

Fun with vectors!