Lit-path! datatype

1. Abstract

A lit-path! is a quoted or unevaluated path!.

A lit-path! value will decay into a path! value when evaluated, such as when entered into the Red REPL.

Lit-path! is a member of the following typesets: any-block!, any-path!, series!

2. Creation

Lit-path! values can be created using quote and literal syntax, or at runtime by using a make constructor or to conversion.

>> quote 'foo/bar/baz
== 'foo/bar/baz
>> make lit-path! [foo bar baz]
== 'foo/bar/baz

You can create an empty lit-path of a given size by supplying an integer value as an argument to make:

>> make lit-path! 10
== '

To conversion:

>> to lit-path! "foo bar baz"
== 'foo/bar/baz

3. Literal syntax


<lit-path-literal> ::= '<path-literal>

<path-literal> ::= <path-head>/<selector>
<path-head>    ::= <word-literal> | <path-literal>
<selector> ::= <integer> | <word-literal> | :<word-literal> | <paren>


lit-path: [lit-word! some selector]
selector: [#"/" [integer! | word! | get-word! | paren!]]

Path-head datatypes: lit-word!, lit-path!

Selector datatypes: integer!, word!, get-word!, paren!

4. Testing values

Use lit-path? to check if a value is of the lit-path! datatype.

>> lit-path? first ['foo/bar]
== true

>> lit-path? quote 'foo/bar
== true

Use type? to return the datatype of a given value.

>> type? first ['foo/bar]
== lit-path!

>> type? quote 'foo/bar
== lit-path!

5. Pre-defined words

5.1. Functions

lit-path?, to-lit-path

results matching ""

    No results matching ""