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!
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
== /bazA 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!.
|
Use refinement? to check if a value is of the refinement! datatype.
>> refinement? /foo
== true
>> refinement? third [42 "Foo" /bar]
== trueUse type? to return the datatype of a given value.
>> type? /foo
== refinement!
>> type? third [42 "Foo" /bar]
== refinement!