Lit-path! datatype

1. Abstract

A lit-path! value is an unevaluated (quoted) path! value.

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.

>> 'foo/bar/baz
== foo/bar/baz

>> type? 'foo/bar/baz
== path!
>> quote 'foo/bar/baz
== 'foo/bar/baz

>> type? quote 'foo/bar/baz
== lit-path!
>> make lit-path! [foo bar baz]
== 'foo/bar/baz
>> to 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
== '

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. Predefined words

5.1. Functions

lit-path?, to-lit-path

results matching ""

    No results matching ""