Refinement! datatype

1. Abstract

Refinement! values are symbolic values that are used as modifiers to functions or as extensions to objects, files, urls, or paths.

The repend function with no refinement:

>> repend ["foo"] [21 * 2]
== ["foo" 42]

With the /only refinement:

>> repend/only ["foo"] [21 * 2]
== ["foo" [42]]

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

2. Creation

Refinement values can be created using literal syntax, or at runtime by using a make constructor or to conversion.

>> /foo
== /foo
>> make refinement! "bar"
== /bar
>> to refinement! 'baz
== /baz

3. Literal syntax

A forward slash / 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: / \ ^ , [ ] ( ) { } " # $ % @ : ;

Note
Using @ will not raise an error, but will cause the refinement! value to be returned as email!.

4. Comparisons

All comparators can be applied on refinement!: =, ==, <>, >, <, >=, <=, =?.

5. Testing values

Use refinement? to check if a value is of the refinement! datatype.

>> refinement? /foo
== true

>> refinement? third [42 "Foo" /bar]
== true

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

>> type? /foo
== refinement!

>> type? third [42 "Foo" /bar]
== refinement!

6. Predefined words

6.1. Functions

parse-func-spec, refinement?, to-refinement

6.2. Natives

function

results matching ""

    No results matching ""