>> make set-path! [foo bar baz] == foo/bar/baz:
Set-path! sets a "contextual reference" (word in a context, indexes slot in a series, or keyed reference in a series or map).
Set-path! is a member of the following typesets:
Set-path! values can be created at runtime by using a
make constructor or
You can create an empty set-path of a given size by supplying an integer value as an argument to
>> make set-path! 10 == : ==
>> to set-path! "foo bar baz" == foo/bar/baz:
3. Literal syntax
<set-path-literal> ::= <path-literal>: <path-literal> ::= <path-head>/<selector> <path-head> ::= <word-literal> | <path-literal> <selector> ::= <integer> | <word-literal> | :<word-literal> | <paren>
set-path: [set-word! some selector] selector: [#"/" [integer! | word! | get-word! | paren!]]
4. Evaluation Steps
A set-path! value follows the same evaluation rules as
path! until the selector is reached, at which point the selector is set to the value of the expression that follows it.
If there is no expression following the selector, or if the expression returns
unset, an error is raised.
5. Testing values
set-path? to check if a value is of the
>> set-path? first [foo/bar:] == true >> set-path? quote foo/bar: == true
type? to return the datatype of a given value.
>> type? first [foo/bar:] == set-path! >> type? quote foo/bar: == set-path!
6. Predefined words