Lit-word! datatype

1. Abstract

A lit-word! value is an unevaluated word!. It has the literal value of itself.

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

>> 'test
== test

>> type? 'test
== word!

Lit-word! is a member of the following typesets: any-word!, all-word!, immediate!

2. Creation

Lit-word! values can be created using literal syntax, or at runtime using a to conversion from the datatypes: char!, logic!, string!, datatype!, issue!, and refinement!.

>> to lit-word! #"X"
== 'X

>> to lit-word! true
== 'true

>> to lit-word! "Hello"
== 'Hello

>> to lit-word! float!
== 'float!

>> to lit-word! #A42
== 'A42

>> to lit-word! /only
== 'only

3. Literal syntax

An apostrophe ' followed by one or more characters from the entire Unicode range, including punctuation characters from the ASCII subset: ! & ' * + - . < = > ? _ | ~`

Illegal characters are control characters, whitespace characters, and punctuation characters from the ASCII subset: / \ ^ , [ ] ( ) { } " # $ % @ : ;

A lit-word! value cannot begin with a number.

4. Comparisons

All comparators can be applied on lit-word!: =, ==, <>, >, <, >=, <=, =?.

5. Testing values

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

>> lit-word? first ['foo bar baz]
== true

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

>> type? first ['foo bar baz]
== lit-word!

6. Pre-defined words

6.1. Functions

to-lit-word

results matching ""

    No results matching ""