Skip to content

Datatypes

Christopher Ross-Gill edited this page Aug 1, 2016 · 1 revision

Table of Contents

List of Datatypes

Preliminary list as grabbed from the console:

action! datatype-relative native function (polymorphic)
binary! string series of bytes
bitset! set of bit flags
block! series of values
char! 8bit and 16bit character
closure! function with persistent local values (indefinite)
datatype! datatype value
date! day, month, year, time of day, and timezone
decimal! 64bit floating point number (IEEE standard)
email! email address
end! internal marker for end of block
error! error value
event! user interface event (efficiently sized)
file! file name or path
frame! internal context frame
function! interpreted function (user-defined or mezzanine)
get-path! the value of a path
get-word! the value of a word (variable)
gob! graphical object
handle! arbitrary internal object or value
image! RGB image with alpha channel
integer! 64 bit integer
issue! identifying string or script marker
library! external library reference
lit-path! literal path value
lit-word! literal word value
logic! boolean true or false
map! hashed name-value pairs
module! loadable context of code and data
money! arbitrary precision decimal numbers (denominations)
native! direct CPU evaluated function
none! no value represented
object! context of names with values
op! infix operator (special evaluation exception)
pair! two dimensional point or size
paren! automatically evaluating block
path! refinement path for functions, objects, files, etc.
percent! special form of decimals (used mainly for layout)
port! external series, an I/O channel
rebcode! virtual machine function
refinement! variation of meaning or location
routine! external library function
set-path! definition of a path's value
set-word! definition of a word's value
string! string series of characters
struct! native structure definition
tag! markup string (HTML or XML)
task! evaluation environment
time! time of day or duration
tuple! integers sequence (colors, versions, IP addresses)
typeset! set of datatypes
unicode! string of unicoded characters
unset! no value returned or set
url! uniform resource locator or identifier
utype! user defined datatype
vector! multideminsional directly mapped arrays (of same datatype)
word! word (symbol or variable)

Arranged List of Datatypes

All datatypes except end! are arranged in typesets.

end!

any-type!

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!

unset!

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!]] [ ... ]

none!

value
  1. [none]

logic!

value
  1. [true]
value
  1. [false]
>> to integer! true
== 1
>> to integer! false
== 0
Predefined logics
Word Value
false
  1. [false]
no
  1. [false]
off
  1. [false]
true
  1. [true]
yes
  1. [true]
on
  1. [true]

scalar!

A typeset of:

integer! decimal! percent! money! char! pair! tuple! time!

number!

A typeset of:

integer!
decimal!
percent!
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!

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

char!

Minimum
  1. "^(00)"
Maximum
  1. "^(FFFF)"
>> min-char: to char! 0
== #"^@"
>> max-char: to char! 65535
== #"?"

pair!

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!

tuple!
Minimum 0.0.0 ...
Maximum 255.255.255 ...

time!

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

date!

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!

any-string!

A typeset of:

string! binary! file! email! url! tag! issue!

string!
binary!
file!
email!
url!
tag!
issue!

unicode!

vector!

any-block!

A typeset of:

block! paren! path! set-path! get-path! lit-path!

block!
paren!
path!
set-path!
get-path!
lit-path!

bitset!

image!

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.

map!

datatype!

typeset!

any-word!

A typeset of:

word! set-word! get-word! lit-word! refinement!

word!

set-word!

get-word!

lit-word!

refinement!

any-function!

A typeset of:

native! action! routine! rebcode! op! closure! function!

native!

action!

routine!

rebcode!

op!

closure!

function!

frame!

any-object!

A typeset of:

object!

module!

error!

task!

port!

gob!

event!

handle!

struct!

library!

utype!

Clone this wiki locally