Datatypes - r3n/rebol-wiki GitHub Wiki
Preliminary list as grabbed from the console:
|
|
All datatypes except end! are arranged in typesets.
any-type! is typeset of all of these datatypes:
|
unset! none! logic! integer! decimal! percent! |
money! char! pair! tuple! time! date! |
string! binary! file! email! url! tag! |
issue! bitset! unicode! vector! image! block! |
paren! map! path! set-path! get-path! lit-path! |
datatype! typeset! word! set-word! get-word! lit-word! |
refinement! native! action! routine! rebcode! op! |
closure! function! frame! object! module! error! |
task! port! gob! event! handle! struct! |
library! utype! |
No value returned or set. The functions GET and SET have special treatment of unset! values with their /any refinements:
set/any 'a #[unset!] get/any 'a
If functions should be allowed to handle unset! arguments, it should be specified with either unset! or any-type!:
f: func [value [unset!]] [ ... ] f: func [value [any-type!]] [ ... ]
| value |
|
| value |
|
| value |
|
>> to integer! true == 1 >> to integer! false == 0
| Word | Value |
|---|---|
| false |
|
| no |
|
| off |
|
| true |
|
| yes |
|
| on |
|
A typeset of:
integer! decimal! percent! money! char! pair! tuple! time!
A typeset of:
| integer! | decimal! | percent! | |
|---|---|---|---|
| Minimum | -9'223'372'036'854'775'808 | -1.797'693'134'862'315'7E+308 | -1.797'693'134'862'315'7E+310% |
| Maximum | 9'223'372'036'854'775'807 | 1.797'693'134'862'315'7E+308 | 1.797'693'134'862'315'7E+310% |
| Minimal positive normalized | 2.225'073'858'507'201'4E-308 | 2.225'073'858'507'201'4E-306% | |
| Maximal positive denormalized | 2.225'073'858'507'200'9E-308 | 2.225'073'858'507'200'9E-306% | |
| Minimal positive denormalized | 4.940'656'458'412'465'4E-324 | 4.940'656'458'412'465'4E-322% | |
| Maximal negative normalized | -2.225'073'858'507'201'4E-308 | -2.225'073'858'507'201'4E-306% | |
| Minimal negative denormalized | -2.225'073'858'507'200'9E-308 | -2.225'073'858'507'200'9E-306% | |
| Maximal negative denormalized | -4.940'656'458'412'465'4E-324 | -4.940'656'458'412'465'4E-322% |
>> min-integer: to integer! #{8000 0000 0000 0000}
== -9223372036854775808
>> max-integer: to integer! #{7FFF FFFF FFFF FFFF}
== 9223372036854775807
| money! | |
|---|---|
| Minimum | -$99'999'999'999'999'999'999'999'999e127 |
| Maximum | $99'999'999'999'999'999'999'999'999e127 |
| Minimal positive | $1e-128 |
| Maximal negative | -$1e-128 |
| Minimum |
|
| Maximum |
|
>> min-char: to char! 0 == #"^@" >> max-char: to char! 65535 == #"?"
| Minimum | -2147483648x-2147483648 |
| Maximum | 2147483647x2147483647 |
>> min-pair: as-pair to integer! #{8000 0000} to integer! #{8000 0000}
== -2147483648x-2147483648
>> max-pair: as-pair to integer! #{7FFF FFFF} to integer! #{7FFF FFFF}
== 2147483647x2147483647
| tuple! | |
|---|---|
| Minimum | 0.0.0 ... |
| Maximum | 255.255.255 ... |
| Minimum | -596523:14:07.999999999 |
| Maximum | 596523:14:07.999999999 |
>> min-time: (to time! to integer! #{8000 0001}) - 0.999999999
== -596523:14:07.999999999
>> max-time: (to time! to integer! #{7FFF FFFF}) + 0.999999999
== 596523:14:07.999999999
| Minimum | 1-Jan-0000 |
| Maximum | 31-Dec-16383 |
A typeset of:
string! binary! file! email! url! tag! issue! unicode! vector! block! paren! path! set-path! get-path! lit-path!
A typeset of:
string! binary! file! email! url! tag! issue!
A typeset of:
block! paren! path! set-path! get-path! lit-path!
img: make image! 320x240
img/size ;== 320x240
img/rgb ;== #{00000000...
img/alpha ;== #{00000000...
Note: if you want to make image transparent use:
img/alpha: 255
img/alpha: 255
(using change and other series manipulations on alpha channel will not work!)
To draw into image you can use something like:
draw img [pen 255.0.0 line 0x0 320x240] view layout [image img]
You can also create image using binary data directly, like:
img: make image! reduce [4x1 as-binary "Hello world!"] probe as-string img/rgb ;== "Hello world!" view layout [image img 200x80]
If you have raw RGBA binary data, you can create image! from it using:
img: to image! #{FFFFFFC0000000C0}
view layout [image img 200x100]
Another note: In Rebol2 you have to use:
view layout [image img]
... but in Rebol3 (alpha version) you can use just:
view [image img]
... but it would be nice to have chance to do just:
view img
... which is easy to add and it's already submited as a wish.
A typeset of:
word! set-word! get-word! lit-word! refinement!
A typeset of:
native! action! routine! rebcode! op! closure! function!
A typeset of: