m>

REBOL/Core Expert's Guide

Updated: 30-Sep-1998


This document includes a description, examples, and links for every predefined REBOL word in REBOL/Core. Refer to the Quick Start Guide and the User's Guide for discussions and additional examples.


Contents

Input/Output
Math
Comparison
Control
Series
Context
Object
Datatype
Preset Values
Debugging
All Words
Word Definitions

Input/Output

delete echo exists? form format
import info? input input? load
modified? mold prin print probe
read save secure send size?
write

Math

* ** + - /
// abs absolute add all
and any arccosine arcsine arctangent
complement cosine divide even? exp
log-10 log-2 log-e max maximum
min minimum multiply negative? negate
not odd? or positive? power
random remainder sine square-root subtract
tangent xor zero?

Comparison

< <= <> = ==
> >= all any even?
match max maximum min minimum
negative? number? odd? parse positive?
same? zero?

Control

break catch do else exit
for forall foreach forskip halt
if loop parse quit reduce
repeat return shield until while

Series

change clear copy fifth find
first format fourth free func
function head head? index? insert
last length? match next parse
past pick remove second select
skip sort tail tail? third
trim

Context

alias bind use

Object

import info? make make-object rebol

Datatype

binary! binary? block! block? char!
char? date! date? decimal! decimal?
email! email? empty? file! file?
found? free func function function!
function? integer! integer? issue! issue?
logic! logic? make money! money?
native! native? none! none? object!
object? paren! paren? path! path?
port! port? series? string! string?
time! time? tuple! tuple? type?
url! url? word! word?

Preset Values

false newline no none off
on true yes

Debugging

echo halt help probe trace

All Words

* ** + - /
// < <= <> =
== > >= abs absolute
add alias all and any
arccosine arcsine arctangent binary! binary?
bind block! block? break catch
change char! char? clear complement
copy cosine date! date? decimal!
decimal? delete divide do echo
else email! email? empty? even?
exists? exit exp false fifth
file! file? find first for
forall foreach form format forskip
found? fourth free func function
function! function? get halt head
head? help if import index?
info? input input? insert integer!
integer? issue! issue? last length?
load log-10 log-2 log-e logic!
logic? loop make make-object match
max maximum min minimum modified?
mold money! money? multiply native!
native? negative? negate newline next
no none none! none? not
now number? object! object? odd?
off on or paren! paren?
parse past path! path? pick
port! port? positive? power prin
print probe quit random read
rebol reduce remainder remove repeat
return same? save second secure
select send series? set shield
sine size? skip sort square-root
string! string? subtract tail tail?
tangent third time! time? trace
trim true tuple! tuple? type?
unset until url! url? use
value? wait while word! word?
write xor yes zero?

Word Definitions

* value value

A function that multiplies two values. The datatype of the second value may be restricted to INTEGER or DECIMAL, depending on the datatype of the first value (e.g. the first value is a time).

print 123 * 10
1230
print 12.3 * 10
123
print 3:20 * 3
10:00

Related Words: / // multiply divide


** number number

Raise a number to a power. (The operator for the POWER function.)

print 10 ** 2
100
print 12.345 ** 5
286718.33852463553

Related Words: power exp log-2 log-10 log-e


+ value value

A function that adds two values. When adding values of different datatypes, they must be compatible.

print 123 + 1
124
print 1.2.3.4 + 4.3.2.1
5.5.5.5
print 100.200.255.255 + 1.100.0.255
101.255.255.-1
print 12:00 + 11:00
23:00

Related Words: - add subtract


- value value

A function that subtracts the second value from the first. If used with only a single value, then it negates the value (unary minus). When subtracting values of different datatypes, the values must be compatible.

print 123 - 1
122
print -123    ; a negative number
-123
print - 123   ; negating a positive number (unary)
-123
print 1.2.3.4 - 1.0.3.0
0.2.0.4
print 12:00 - 11:00
1:00

Related Words: + add subtract absolute


/ value value

A function that divides the first value by the second. If the second value is zero, an error will occur. When dividing values of different datatypes, they must be compatible.

print 123 / 10
12.3
print 12.3 / 10
1.23
print 1:00 / 60
0:01

Related Words: * //


// integer integer

A function that returns the value the remainder after the first integer is divided by the second. If the second integer is zero, an error will occur.

print 123 // 10
3
print 25:32 // 24:00
1:32

Related Words: * /


< value value

A function that returns TRUE if the first value is less than the second; otherwise, return FALSE. The values must be of the same datatype, or an error will occur. For string-based datatypes, the sorting order is used for comparision with character casing ignored (uppercase = lowercase).

print "abc" < "abcd"
true
print 15-June-1999 < 14-June-1999
false
print 1.2.3.4 < 4.3.2.1
true
print 1:30 < 2:00
true

Related Words: <= > >= = <> min max


<= value value

A function that returns TRUE if the first value is less than or equal to the second; otherwise, return FALSE. For string-based datatypes, the sorting order is used for comparision with character casing ignored (uppercase = lowercase).

print "abc" <= "abd"
true
print 14-June-1999 <= 15-June-1999
true
print 4.3.2.1 <= 1.2.3.4
false
print 1:23 <= 10:00
true

Related Words: < > >= = <> min max


<> value value

A function that returns TRUE if the values are not equal (even when they are of different datatypes). String-based datatypes are considered equal when they are identical or differ only by character casing (uppercase = lowercase).

print "abc" <> "abcd"
true
print [1 2 4] <> [1 2 3]
true
print 12-sep-98 <> 10:30
true

Related Words: = ==


= value value

A function that returns TRUE if the values are equal. String-based datatypes are considered equal when they are identical or differ only by character casing (uppercase = lowercase).

print 123 = 123
true
print "abc" = "abc"
true
print [1 2 3] = [1 2 4]
false
print 15-June-1998 = 15-June-1999
false
print 1.2.3.4 = 1.2.3.0
false
print 1:23 = 1:23
true

Related Words: <> ==


== value value

A function that returns TRUE if the values are equal. Similar to "=" except when the values are of a different datatype, then an error will occur. String-based datatypes are considered equal when they are identical or differ only by character casing (uppercase = lowercase).

print 123 == 123
true
print "abc" == "abd"
false

Related Words: != = <>


> value value

A function that returns TRUE if the first value is greater than the second; otherwise, return FALSE. The values must be of the same datatype or an error will occur. For string-based datatypes, the sorting order is used for comparision with character casing ignored (uppercase = lowercase).

print "abc" > "abb"
true
print 16-June-1999 > 15-June-1999
true
print 4.3.2.1 > 1.2.3.4
true
print 11:00 > 12:00
false

Related Words: < <= >= = <> min max


>= value value

A function that returns TRUE if the first value is greater than or equal to the second; otherwise, return FALSE. The values must be of the same datatype or an error will occur. For string-based datatypes, the sorting order is used for comparision with character casing ignored (uppercase = lowercase).

print "abc" >= "abb"
true
print 16-June-1999 >= 15-June-1999
true
print 1.2.3.4 >= 4.3.2.1
false
print 11:00 >= 11:00
true

Related Words: < <= > = <> min max


abs value

Return the absolute value (the postive value equal in magnitude). Same as ABSOLUTE.

print abs -123
123
print abs -1:23
1:23

Related Words: - absolute


absolute value

Return the absolute value (the postive value equal in magnitude). Same as ABS.

print absolute -123
123
print absolute -1:23
1:23

Related Words: -


add value value

A function that adds two values. When adding values of different datatypes, they must be compatible.

print add 123 1
124
print add 1.2.3.4 4.3.2.1
5.5.5.5
print add 3:00 -4:00
-1:00

Related Words: + - subtract


alias symbol string

Create a new word from the STRING that is an alternative spelling for the symbol and is identical in every respect (symbol comparision and variable referencing). Currently, the ALIAS must be done prior to loading files containing the new symbol. This is intended to support localized words within REBOL.

alias 'print "stampa"
aliases: [
    print "intpray"
    load  "oadlay"
]
foreach [word string] aliases [alias word string]
[alias word string]
    


all block

Determines if all of the expressions within the block have a worthwhile value. Evaluates each expression of a block and if all of them have a value other than FALSE or NONE, then TRUE is returned.

a: 100
b: -100
if all [(a > b) (a > 10) (b < -3)] [print "all were true"]
were true"]
    
all were true


and value value

A function that returns the first value ANDed with the second. For LOGIC values, both must be TRUE to return TRUE, otherwise a FALSE is returned. For integers, each bit is separately affected.

print 123 and 1
1
print true and true
true
print true and false
false
print (10 < 20) and (20 > 15)
true
print 1.2.3.4 and 255.0.255.0 
1.0.3.0

Related Words: or not xor logic? integer?


any block

Determines if any of the expressions within the block has a worthwhile value. Evaluates each expression of a block and returns the value of the first one that is not NONE or FALSE. If no expressions return such a value, then TRUE is returned.

a: 100
b: -100
if any [(a > b) (a > 10) (b < -3)] [print "one was true"]
 was true"]
    
one was true


arccosine value

Return the trigonometric arccosine value.

print arccosine .5
1.0471975511965976

Related Words: sine cosine tangent arcsine arctangent


arcsine value

Return the trigonometric arcsine value.

print arcsine .5
0.5235987755982989

Related Words: sine cosine tangent arccosine arctangent


arctangent value

Return the trigonometric arctangent value.

print arctangent 22
1.5253730473733196

Related Words: sine cosine tangent arcsine arccosine


binary!

A word used to represent the BINARY datatype, both externally to the user and internally within the system. It returns a value that is of the same datatype so it can be used to MAKE new values of that type.

Related Words: binary? make type?


binary? value

Return TRUE if the value is a BINARY series and FALSE for all other values.

print binary? #{1234abcd}
true

Related Words: binary! type?


bind block

Bind all of the words in the block into the current context. Allows blocks to be exchanged between contexts, permitting their words (variables) to be interpreted.

settings: [start + duration]

schedule: function [start] [duration] [
    duration: 1:00
    do bind settings
]
;!!! print schedule 10:30  
;!!! print schedule 10:30  
    

Related Words: use do func function


block!

A word used to represent the BLOCK datatype, both externally to the user and internally within the system. It returns a value that is of the same datatype which can be used to MAKE new values of that type.

nums: make block! 10
repeat n 10 [ insert tail nums n ]
print nums
 print nums
    
1 2 3 4 5 6 7 8 9 10 

Related Words: block? make type?


block? value

Return TRUE if the value is a block and FALSE for all other values.

print block? "1 2 3"
false
print block? [1 2 3]
true
data: load "1 2 3"
if block? data [print data]
t data]
    
1 2 3 

Related Words: block! type?


break

Break out of a loop function (REPEAT, WHILE, FOREACH, etc.). The loop is immediately terminated and evaluation resumes after the LOOP function. This function can be evaluated anywhere within the block being repeated, even within a sub block or function.

m: 0
repeat n 5 [
    print n
    if n > 3 [ break ]
    m: n
]
 ]
        m: n
    ]
    
1
2
3
4

Related Words: catch shield exit return


catch symbol block

Define the symbol as a function that catches within the given block. When the throw function is used anywhere within the block, it will cause control to be returned directly to the point after the CATCH. The throw function takes a single argument: the value to return from the CATCH. If the throw is not evaluted, then the result of the block is returned from the CATCH. Read more about the concept of continuations in the user's guide.

print catch 'throw [
    loop 100 [
        if (random 10) > 5 [throw "hit"]
    ]
    "miss"
]

        "miss"
    ]
    
hit

Related Words: break shield


change series value /part length /only /dup count

Change values within a series. If the second argument is a simple value, it will replace the value at the current position in the first series. If the second argument is a series compatible with the first (block or string-based datatype), then all of its values will replace those of the first argument or series. The /PART refinement will change a given number of values (specified as either a count or as an ending series position). The /ONLY refinement will treat a series value as a single value and is normally used to change a block as a block, rather than as a series of values. The /DUP will repeat the change for the number of times specified.

title: copy "how it REBOL"
change title "N"
print title
print title
    
Now it REBOL
change find title "t" "s"
print title
t title
    
Now is REBOL
blk: copy ["now" 12:34 "REBOL"]
change next blk "is"
print blk
  print blk
    
now is REBOL 

Related Words: insert remove clear


char!

A word used to represent the CHAR datatype, both externally to the user and internally within the system. It returns a value that is of the same datatype which can be used to MAKE new values of that type.

char: #"A"
print type? char
e? char
    
char!
print char
A
print head insert "BCD" char
ABCD

Related Words: char? make type?


char? value

Return TRUE if the value is a CHAR and FALSE for all other values.

print char? #"!"
true

Related Words: char! type?


clear series

Remove values through the end of a series. The NEXT, PAST, SKIP, and FIND functions can be used to locate the series to the desired position.

str: copy "with all things considered"
clear skip str 8
print str
  print str
    
with all

Related Words: change insert remove


complement value

Return the one's complement of an integer. Used for bitmasking of integer numbers and tuples.

print complement 0
-1

Related Words: negate


copy series /part length /deep

Create a new value by copying another. This is shorthand for MAKE with a zero additional length parameter. For series, the /PART refinement will copy a given number of values (specified as either a count or as an ending series position). The /DEEP refinement will recursively copy all blocks used within a block.

str: copy "with all things considered"
print str
int str
    
with all things considered
strings: copy ["how" "flies"]
print strings
strings
    
how flies 
insert next strings "time"
print strings
strings
    
how time flies 

Related Words: change clear free insert make remove


cosine number

Return the trigonometric cosine value.

print cosine 90
0
print (cosine 45) = (sine 45)
true

Related Words: sine tangent arcsine arccosine arctangent


date!

A word used to represent the DATE datatype, both externally to the user and internally within the system. It returns a value that is of the same datatype which can be used to MAKE new values of that type.

when: make date! [30 6 1999]
    print when
30/Jun/1999
print date? "ABC"
false

Related Words: date? make type?


date? value

Return TRUE if the value is a date and FALSE for all other values.

print date? 15-June-1999
true

Related Words: date! type?


decimal!

A word used to represent the DECIMAL datatype, both externally to the user and internally within the system. It returns a value that is of the same datatype which can be used to MAKE new values of that type.

value: make decimal! "3.1415"
print value
t value
    
3.1415

Related Words: decimal? make type?


decimal? value

Return TRUE if the value is a decimal and FALSE for all other values.

print decimal? 2
false
print decimal? 3.2
true

Related Words: decimal! type?


delete file /files

Delete a file, block of files, or directories. The /FILES refinement will prevent the deletion of directories. Wildcards can be used to specify the file pattern.

write %junkfile.tst "delete me"
delete %junkfile.tst
ile.tst
    

Related Words: exists? load protect


divide value value

A function that divides the first value by the second. If the second value is zero, an error will occur. When dividing values of different datatypes, they must be compatible.

print divide 123.1 12
10.258333333333333
print divide 10:00 4
2:30

Related Words: * / // multiply


do value

Evaluate a value. If it is a block, the values in the block will be evaluated. If the value is a STRING, the STRING will be translated then evaluated. If the value is a FILE or URL, it will be loaded and evaluated. The result of the evaluation will be returned.

do "repeat n 3 [print n]"
print do "1 + 2"
"1 + 2"
    
1
2
3
3
do [ print "doing" ]
print do [1 + 2]
[1 + 2]
    
doing
3
blk: [
    [print "test"]
    [loop 3 [print "loop"]]
]
do second blk

    do second blk
    
loop
loop
loop
do first blk
blk
    
test

Related Words: load reduce loop repeat


echo file

Save output to a file as well as the user console. The previous contents of the file will be overwritten. The operation can be terminated at any time with: echo none. Note that the examples below are commented because this document is the output of a REBOL script.

echo %watch.txt
print "hello world"
 world"
    
hello world
echo none
one
    

Related Words: print trace


else block

Evaluate a block when the prior IF condition was FALSE, or skip the block if the IF was TRUE. ELSE must follow immediately after the IF block.

size: 100
if size > 500 [ print "wrong" ]
else [ print "right" ]
t "right" ]
    
right

Related Words: if


email!

A word used to represent the EMAIL datatype, both externally to the user and internally within the system. It returns a value that is of the same datatype so it can be used to MAKE new values of that type.

print make email! ["user" "domain.com"]
user@domain.com

Related Words: email? make type?


email? value

Return TRUE if the value is an EMAIL and FALSE for all other values.

print email? user@domain.com
true

Related Words: email! type?


empty? series

Return TRUE if the series is empty and FALSE for all other values.

print empty? []
true
print empty? [1]
false

Related Words: none? found?


even? integer

Return TRUE if the INTEGER is even (divisable by 2).

print even? 100
true
print even? 7
false

Related Words: odd?


exists? value

Return TRUE if the file or URL exists and FALSE if not.

print exists? %reboldoc.r
true
print exists? %doc.r
false

Related Words: read write open delete modified?


exit

Exit the current user function immediately. Do not return a result.

test-str: make function! [str] [
    if not string? str [ exit ]
    print str
]
test-str 10
test-str "right"
0
    test-str "right"
    
right

Related Words: return catch break


exp value

Raises E (natural number) to the power specified.

print exp 3
p 3
    
12.208071553855563

Related Words: log-2 log-10 log-e square-root power


false

Returns LOGIC value for not TRUE.

print false
false
print not true
false
print 1 > 2
false

Related Words: true on off yes no


fifth series

Return the fifth value of the series. An error will occur if no value is found. Use the PICK function to avoid this error.

print fifth "REBOL"
L
print fifth [11 22 33 44 55 66]
55

Related Words: pick first second third fourth


file!

A word used to represent the FILE datatype, both externally to the user and internally within the system. It returns a value that is of the same datatype so it can be used to MAKE new values of that type.

print make file! "image.jpg"
image.jpg

Related Words: file? make type?


file? value

Return TRUE if the value is a file and FALSE for all other values.

print file? %image.jpg
true
print file? "REBOL"
false

Related Words: file! type?


find series value /case

Find a value within a series. If found, return the series as of that position; otherwise, return NONE. The /CASE refinement enables character case sensitive searching.

print find "here and now" "and"
and now
print find [12:30 123 c@d.com] 123
123 c@d.com 
print find [1 2 3 4] 5
none

Related Words: match select pick


first series

Return the first value of a series. An error will occur if no value is found. Use the PICK function to avoid this error.

print first "REBOL"
R
print first [11 22 33 44 55 66]
11
print first 1:30
1
print first 199.4.80.1
199
print first 12:34:56.78
12

Related Words: pick second third fourth fifth


for word start end skip block

Evaluate a block over a range of values. A word is used as a local variable to keep track of the current value. It is initially set to the START value and after each evaluation of the block the SKIP value is added to it until the END value is reached (inclusive).

for num 0 30 10 [ print num ]
0
10
20
30
for num 4 -37 -15 [ print num ]
4
-11
-26

Related Words: forall foreach forskip


forall word block

Evaluate a block once for all values in a series. Prior to evaluation, the WORD argument must be set to the desired starting position within the series (normally the head, but any position is valid). For each evaluation of the block, the word will be advanced to the next position within the series. The word is local to the block.

cities: [ "Eureka" "Ukiah" "Santa Rosa" "Mendocino" ]
forall cities [ print first cities ]
ities ]
    
Eureka
Ukiah
Santa Rosa
Mendocino
chars: "abcdef"
forall chars [ print first chars ]
chars ]
    
a
b
c
d
e
f

Related Words: for foreach forskip


foreach words series block

Identical to REPEAT. Evaluate a block once for each value in a series. For each evaluation of the block, the word will be set to the first value in the series. The WORDS argument can be a single word or a block of words and they are local to the block.

cities: [ "Eureka" "Ukiah" "Santa Rosa" "Mendocino" ]
foreach city cities [ print city ]
 city ]
    
Eureka
Ukiah
Santa Rosa
Mendocino
chars: "abcdef"
foreach char chars [ print char ]
 char ]
    
a
b
c
d
e
f

Related Words: for forall forskip


form value

Creates a string equivalent to the value passed.

print form 10:30
10:30
print form %image.jpg
image.jpg
str: form [123 "-string-" word]
print str
int str
    
[123 -string- word]

Related Words: format mold


format rules value

Format output according to a set of layout rules.

Related Words: parse


forskip word integer block

Evaluate a block for periodic values in a series. Prior to evaluation, the word must be set to the desired starting position within the series (normally the head, but any position is valid). After each evaluation of the block, the word's position in the series is changed by skipping the number of values specified by the second argument (see the SKIP function). The word will be restored to its original value on completion.

areacodes: [
    "Ukiah"         707
    "San Francisco" 415
    "Sacramento"    916
]

forskip areacodes 2 [
    print [ first areacodes "area code is" second areacodes]
]
de is" second areacodes]
    ]
    
Ukiah area code is 707 
San Francisco area code is 415 
Sacramento area code is 916 

Related Words: for forall foreach


found? value

Return TRUE if the value is not NONE and FALSE for all other values.

if found? find carl@rebol.com ".com" [print "found it"]
found it

Related Words: find match pick


fourth series

Return the fourth value of a series. An error will occur if no value is found. Use the PICK function to avoid this error.

print fourth "REBOL"
O
print fourth [11 22 33 44 55 66]
44
print fourth 199.4.80.1
1

Related Words: first second third fifth pick


free value

An optional function to release the resources of a value. Not required, because REBOL will release unused resources as needed.

string: make string! 250
free string
 string
    

Related Words: make


func value

A convenient helper function for creating user functions.

sum: func [a b] [a + b]
print sum 123 321
123 321
    
444
print function? 'sum
false

Related Words: make function! function?


function value

A convenient helper function for creating user functions with local (hidden) variables.

average: function [block] [total] [
    total: 0
    foreach number block [total: number + total]
    ; (function returns the total)
]
print average [1 10 12.32]
nt average [1 10 12.32]
    
23.32

Related Words: make use function! function?


function!

A word used to represent the FUNCTION datatype, both externally to the user and internally within the system. It returns a value that is of the same datatype so it can be used to MAKE new values of that type. Setting a function to a word is optional. REBOL allows unnamed functions.

test: make function! [str] [
    print str
]
test "simple"
  test "simple"
    
simple
print do (make function! [n] [n * 123]) 10
 10
    
1230

Related Words: function? make type?


function? value

Return TRUE if the value is a function and FALSE for all other values.

print function? :func
unc
    
true

Related Words: function! type?


get word

Get the value of a word (used as a variable).

words: [true false]
if get first words [print "it's true!"]
true!"]
    
it's true!

Related Words: set


halt

Stop evaluation and return to the input prompt. Useful for program debugging. Note that the example below is commented because this document is the output of a REBOL script.

name: 10
if not string? name [
    print "not a string"
;!!!       halt
]
    halt
    ]
    
not a string

Related Words: break exit catch


head series

Return the initial beginning position of a series.

str: "with all things"
here: find str "all"
print here
 print here
    
all things
print head here
ere
    
with all things

Related Words: head? tail tail?


head? series

Return TRUE if a series is at its head.

str: tail "with all things considered"
print head? str
ad? str
    
false
blk: tail [264 "Rebol Dr." "Calpella" CA 95418]
until [
    blk: past blk
    print first blk
    head? blk
]
       head? blk
    ]
    
95418
ca
Calpella
Rebol Dr.
264

Related Words: head tail tail?


help word

Print usage information about a REBOL word.

help quit
uit
    


if logic block

Evaluate the block if the first value is TRUE. Skip the block if the value is FALSE. The block can be followed by an ELSE and a block to be evaluated when the value is FALSE.

age: 4
if age > 3 [ print "wine is ready" ]
else [ print "keep it in the bottle longer"]
le longer"]
    
wine is ready

Related Words: else


import object value

Import a value into an object of the given structure.

Related Words:


index? series

Return the index position of a series -- the number of elements from its head (inclusive).

str: "with all things considered"
print index? str
ex? str
    
1
print index? find str "things"
10
blk: [264 "Rebol Dr." "Calpella" CA 95418]
print index? find blk 95418
k 95418
    
5

Related Words: head head? tail tail? pick skip


info? value

Return an object holding information about the value. For a file value, the size, date, and attributes of the file are returned. For ports, the port object is returned.

print info? %reboldoc.r
#[file-status!]


input

Return a string from the standard input device (normally the keyboard, but can also be a file). Evaluation will stop until a string is entered.

prin "Enter a name:"
name: input
print [ name "is" length? name "characters long"]
ters long"]
    
Enter a name:Sam
Sam
 is 4 characters long 

Related Words: input?


input?

Return TRUE if characters are available at the standard input device. This function offers a simple means of detecting input within scripts.

print input?
true
if input? [name: input]
Sam

Related Words: input


insert series value /part length /only /dup count

Insert a value into a series at the current position (before the current value). If the value is a series compatible with the first (block or string-based datatype), then all of its values will be inserted. The series position just past the insert is returned, allowing multiple inserts to be cascaded together. The /PART refinement will insert a specified number of values (as either a count or as an ending series position). The /ONLY refinement will treat a series value as a single value and is used to insert a block as a block, rather than as a series of values. The /DUP will repeat the insert for the number of times specified.

blk: [1 2]
insert next blk '+
print blk
  print blk
    
3 
blk: [10:30 "Test"]
insert next blk [1 2 3]
print blk
  print blk
    
10:30 1 2 3 Test 
str: "with things considered"
insert (find str "things") "all "
print str
  print str
    
with all things considered

Related Words: change clear head remove tail


integer!

A word used to represent the INTEGER datatype, both externally to the user and internally within the system. It returns a value that is of the same datatype so it can be used to MAKE new values of that type.

print make integer! "12345"
12345

Related Words: integer? make type?


integer? value

Returns TRUE if the value is an integer and FALSE for all other values.

print integer? -1234
true
print integer? "string"
false

Related Words: integer! type?


issue!

A word used to represent the ISSUE datatype, both externally to the user and internally within the system. It returns a value that is of the same datatype so it can be used to MAKE new values of that type.

print make issue! "1234-56-7890"
1234-56-7890

Related Words: issue? make type?


issue? value

Return TRUE if the value is an issue and FALSE for all other values.

print issue? #1234-5678-9012
true

Related Words: issue! type?


last series

Return the last value of a series. An error will occur if no value is found. Use the PICK function to avoid this error.

print last "REBOL"
L
print last [11 22 33 44 55 66]
66

Related Words: first pick tail tail?


length? series

Returns the length of the series. The length is the number of values from the current position to the tail. Use the head function to obtain the length of the entire series.

print length? "REBOL"
5
print length? [1 2 3 [4 5]]
4

Related Words: head


load value

Read and convert values for use by REBOL. This is a smart function because it checks to determine the datatype of the value. For files, the file will be read into memory and examined to determine its datatype. If it contains REBOL, the REBOL will be translated and returned. If no REBOL is found, then a text file will be returned. Other types of files (graphics and sound, etc.) will be added in future releases.

data: load "11 22 33 44"
print third data
rd data
    
33
blk: load "repeat n 3 [print n]"
do blk
 do blk
    
1
2
3

Related Words: read save do


log-10 number

Returns the base 10 logarithm of a value.

print log-10 1234
3.091315159697223

Related Words: log-2 log-e square-root power


log-2 number

Returns the base 2 logarithm of a value.

print log-2 1234
10.269126679149418

Related Words: log-10 log-e power


log-e number

Returns the base E (natural number) logarithm of a value.

print log-e 1234
7.1180162044653335
print exp log-e 1234
378.6667233645121

Related Words: log-2 log-10 power exp


logic!

A word used to represent the LOGIC datatype, both externally to the user and internally within the system. It returns a value that is of the same datatype so it can be used to MAKE new values of that type.

print make logic! 1
true

Related Words: logic? make type?


logic? value

Return TRUE if the value is of the LOGIC datatype and FALSE for all other values.

print logic? true
true
if logic? (1 <> 2) [ print true ]
true

Related Words: logic! type?


loop integer block

Evaluate a block a given number of times. Return the value of the final execution of the block. The BREAK function can be used to stop the loop at any time (but no value is returned). The REPEAT function is simplar to LOOP but keeps track of the current loop count.

loop 40 [prin "*"]
print ""
rint ""
    
****************************************

Related Words: break repeat for while until


make value constructor

Create a new REBOL value. The VALUE argument is an example of the datatype to create. For instance, to make a string, the value can be a string or the word STRING! (which is a variable that holds a predefined string). The contents of the value will be copied to the newly made value. The form of the constructor is determined by the datatype. For most series datatypes, it can be an integer size which can be added to the length of the first string to determine the initial allocation size for the new string.

cash: make money! 1234.56
print cash
time: make time! [10 30 40]
print time

    print time
    
$1234.56
10:30:40

Related Words: copy free type?


make-object parent hidden instance

Make a new object based on a given parent object, containing the hidden and instance varibles specified. The instance variables are written in the same format as those given in a normal make object! argument.

bolt: make-object object! [size] [
	set-size: func [value] [size: value]
	get-size: func [] [size]
]
bolt/set-size 10
print bolt/get-size
    print bolt/get-size
    
10

Related Words: object! object? use function


match series series /part length /with string /any

Compare two series and return NONE if they are not the same, and the end position of the match if they are the same (which in the simple cases is usually the tail of the series). The result of a MATCH is often passed to control functions such as IF, WHILE, or UNTIL. If the /PART refinement is used, match will only compare the specified number of characters. A match can also be made against wild card patterns. The /ANY attribute is used to indicate that the match can be made with any string that fits the pattern. Essentially, it allows the same pattern matching features that are applied to file directories. A ? matches any character and a * matches zero or more chars. Advanced users may want to use patterns containing the wild cards as characters. To do this, use /WITH to specify alternate wild chars with a string. The first char in the string is used as the char for single char matches (change from '?'), and the second is for any sequence (change from '*').

str: "abcde"
print match str "ABCDE"
if found? match/any str "*c*e" [print "got it"]
t "got it"]
    

got it
file: %testall.r
if found? match/any file %*.r [print "file found"]
found"]
    
file found
url: http://www.rebol.com
print match/any url "www"
l "www"
   	
none

Related Words: find select pick


max value value

Return the greater of two values. Same as MAXIMUM.

print max 123 122
123
print max 16-June-1999 15-June-1999
16/Jun/1999
print max 1.2.3.4 4.3.2.1
4.3.2.1

Related Words: < > maximum min minimum


maximum value value

Return the greater of two values. Same as MAX.

print maximum "abc" "abd"
abd
print maximum 12:00 11:00
12:00

Related Words: < > max min minimum


min value value

Return the lessor of two values. Same as MINIMUM.

print min 123 122
122
print min 16-June-1999 15-June-1999
15/Jun/1999
print min 1.2.3.4 4.3.2.1
1.2.3.4

Related Words: < > minimum max maximum


minimum value value

Return the lessor of two values. Same as MIN.

print maximum "abc" "abd"
abd
print maximum 12:00 11:00
12:00

Related Words: < > min max maximum


modified? value

Return the file modification date, or NONE if the file does not exist.

print modified? %reboldoc.r
none

Related Words: exists?


mold value

Format a value and copy it into a string at the position given. Differs from FORM because it produces a REBOL readable string. For example, a block will contain [ ] and strings will be quoted or use { } if it is long or contains special characters. MOLD returns the string just past the insertion point, permitting cascaded use.

print mold 10:30
10:30
print mold %image.jpg
%image.jpg
print mold [1 2 3]
[1 2 3]

Related Words: form format


money!

A word used to represent the MONEY datatype, both externally to the user and internally within the system. It returns a value that is of the same datatype so it can be used to MAKE new values of that type.

print make money! "123"
23"
    
none

Related Words: money? make type?


money? value

Return TRUE if the value is money and FALSE for all other values.

print money? $123
true
print money? 123.00
false

Related Words: money! type?


multiply value value

A function that multiplies two values. The datatype of the second value may be restricted to INTEGER or DECIMAL, depending on the datatype of the first value (e.g. the first value is a time).

print multiply 123 10
1230
print multiply 3:20 3
10:00
print multiply 0:01 60
1:00

Related Words: * / // divide


native!

A word used to represent the NATIVE datatype, both externally to the user and internally within the system. It returns a value that is of the same datatype so it can be used to MAKE new values of that type.

Related Words: native? make type?


native? value

Return TRUE if the value is a native function and FALSE for all other values.

print native? :native?
true
print native? "Vichy"
false

Related Words: native! type?


negative? number

Return TRUE if the number is negative.

print negative? 50
false
print negative? -50
true

Related Words: positive?


negate number

Change the sign of a number.

print negate 123
print negate 123.45
 123.45
    
-123
-123.45

Related Words: + - positive? negative?


newline

A string that when printed begins a new line.

print "start"
print newline
print "end"
print "end"
    
start


end

Related Words: prin print


next series

Return the series at its next position. If the series is at its tail, it will remain at its tail. NEXT will not go past the tail, nor will it wrap to the head.

str: "REBOL"
loop length? str [
    print str
    str: next str
]
tr: next str
    ]
    
REBOL
EBOL
BOL
OL
L
blk: ["red" "green" "blue"]
loop length? blk [
    print blk
    blk: next blk
]
lk: next blk
    ]
    
red green blue 
green blue 
blue 

Related Words: past first head tail head? tail?


no

Another word for LOGIC FALSE.

Related Words: true false on off yes


none

A value that is equivalent to NONE!

print none
none

Related Words: none? none!


none!

A word used to represent the NONE datatype, both externally to the user and internally within the system. It returns a value that is of the same datatype so it can be used to MAKE new values of that type.

Related Words: none none?


none? value

Return TRUE if the value is of the NONE datatype and FALSE for all other values.

print none? NONE
true
print none? pick "abc" 4
true
print none? find "abc" "d"
true

Related Words: none none!


not value

Return the complement of a LOGIC value. That is, return TRUE if the value is FALSE, and FALSE if it is TRUE. To bitwise complement an INTEGER, use the "~" function.

print not true
false
print not (10 = 1)
true

Related Words: and or xor


now

Return the current local DATE and TIME as a single DATE value.

print now
1/Oct/1998/6:38:31
print fourth now
6:38:31

Related Words: date?


number? value

Return TRUE if the value is a number.

print number? 1234
true
print number? 12.34
true
print number? "1234"
false

Related Words: integer? decimal?


object!

A word used to represent the OBJECT datatype, both externally to the user and internally within the system. It returns a value that is of the same datatype so it can be used to MAKE new values of that type.

obj: make object! [
    name: "alpha"
    size: 12
    type: 'rebel
]
print obj/name
  ]
    print obj/name
    
alpha

Related Words: make object? type?


object? value

Return TRUE if the value is an object and FALSE for all other values.

print object? REBOL
true

Related Words: object! type?


odd? integer

Return TRUE for odd integers.

print odd? 3
true
print odd? 100
false
print odd? 0
false

Related Words: even?


off

Another word for LOGIC FALSE.

Related Words: on true false


on

Another word for LOGIC TRUE.

Related Words: off true false


or value value

A function that returns the first value ORed with the second. For LOGIC values, both must be FALSE to return FALSE; otherwise a TRUE is returned. For integers, each bit is separately affected.

print 122 or 1
123
print true or false
true
print (10 > 20) or (20 < 100)
true
print 1.2.3.4 or 255.255.255.0
255.255.255.4

Related Words: and not xor


paren!

A word used to represent the PAREN datatype, both externally to the user and internally within the system. It returns a value that is of the same datatype so it can be used to MAKE new values of that type.

Related Words: paren? make type?


paren?

Return TRUE if the value is of the PAREN datatype and FALSE for all other values.

print paren? second [123 (456 + 7)]
true
print paren? last [1 2 3]
false

Related Words: paren! type?


parse rules value

Parse a string or block for values and structure conforming to a set of grammatical rules.

Related Words: format


past series

Return a series back one position. If the series is at its head, it will remain at its head. PAST will not go past the head, nor will it wrap to the tail.

str: tail "time"
until [
    str: past str
    print str
    head? str
]
       head? str
    ]
    
e
me
ime
time
blk: tail [1 2 3 4]
until [
    blk: past blk
    print blk
    head? blk
]
       head? blk
    ]
    
4 
3 4 
2 3 4 
1 2 3 4 

Related Words: next last head tail head? tail?


path!

A word used to represent the PATH datatype, both externally to the user and internally within the system. It returns a value that is of the same datatype so it can be used to MAKE new values of that type.

print make path! [a b c]
a/b/c

Related Words: path? make type?


path? value

Return TRUE if the value is a path and FALSE for all other values.

print path? first [random/seed 10]
true

Related Words: path! make


pick series integer

Return a value from a given position in a series. The value is picked relative to the current position in the series (not necessarily the head). The VALUE argument may be INTEGER or LOGIC. A positive integer positions forward, a negative positions backward. If the INTEGER is out of range, NONE is returned. If the value is LOGIC, then TRUE refers to the first position and FALSE to the second (same order as IF). An attempt to pick a value beyond the limits of the series will return NONE.

str: "REBOL"
print pick str 2
E
print pick 199.4.80.1 3
80

Related Words: first second third fourth fifth find select


port!

A word used to represent the PORT datatype, both externally to the user and internally within the system. It returns a value that is of the same datatype so it can be used to MAKE new values of that type.

Related Words: port? make type?


port? value

Return TRUE if the value is a PORT and FALSE for all other values.

print port? port!
false

Related Words: port! make! type?


positive? value

Return TRUE if the integer is positive.

print positive? 50
true
print positive? -50
false

Related Words: negative?


power number number

Raise a number to a power.

print power 10 2
100
print power 12.3 5
281530.5684300001

Related Words: ** exp log-2 log-10 log-e


prin value

Output a value. No line termination is used, so the next value printed will appear on the same line. If the value is a block, each of its values will be evaluated first then printed.

prin "The value is"
prin [1 + 2]
[1 + 2]
    
The value is3 
print ""

Related Words: print


print value

Output a value and start a new line; the line is terminated. If the value is a block, each of its values will be evaluated first then printed.

print 1234
1234
print ["The value is" 1 + 2]
The value is 3 

Related Words: prin


probe value

Print values in their REBOL format, not as the PRINT function would output them. Returns the same value that it was passed.

probe 10
 PROBE --> 10
probe :print
 PROBE --> #[function [value] [prin :value linefeed-port output-port exit]]
probe ["red" "green" "blue"]
 PROBE --> ["red" "green" "blue"]


quit

Stop evaluation and exit REBOL, releasing all of its resources back to the system.

noon: 12:00
if 13:30 > noon [
    print "time for lunch"
    quit
]
        quit
    ]
    
time for lunch

Related Words: halt exit break catch


random value /seed value

Return a random value of the same datatype. The value passed can be used to restrict the range of the random result. For integers, random begins at one, not zero, and are inclusive of the value given. (This conforms to the indexing style used for all series datatypes, allowing random to be used directly with functions like PICK.) The /SEED refinement can be used to change the random pattern generated

loop 4 [print random 10]
10]
    
6
5
1
6
lunch: ["Italian" "French" "Japanese" "American"]
print pick lunch random 4
andom 4
    
Japanese
loop 3 [print random true]

    
true
true
true
loop 5 [print random 1:00:00]
00]
    
0:36:03
0:35:04
0:41:31
0:41:55
0:36:57


read /part length /binary /string

Read the contents of a file or URL as a string or binary value. Partial reads can be performed with the /PART refinement which specifies a length. The /BINARY refinement forces the result to be binary data, not a string.

print length? read %reboldoc.r
74334

Related Words: write load save


rebol

The REBOL system object. Provides access to REBOL internal values.


reduce block

Evaluate all expressions in a block and produce a block which holds the results.

values: reduce [1 + 2 3 + 4]
print values
 values
    
3 7 

Related Words: do foreach


remainder integer integer

A function that returns the remainder after the first integer is divided by the second. If the second integer is zero, an error will occur.

print remainder 123 10
3
print remainder 10 10
0

Related Words: // * /


remove series /part length

Remove a value (or multiple values) from a series. Return the series just after the removed value. The /PART refinement will remove a given number of values, specified as either a count or as an ending series position.

str: copy "email"
remove str
print str
  print str
    
mail
blk: copy ["red" "green" "blue"]
remove next blk
print blk
  print blk
    
red blue 

Related Words: clear change insert


repeat word value block

Evaluate a block a number of times. If the value is an integer, the word is used to keep track of the current loop count, which begins at one and continues up to and including the integer value given. If the value is a series, then the word holds the first value of each element of the series (see FOREACH). Return the value of the final evaluation. The BREAK function can be used to stop the loop at any time (but no value is returned). The word is local to the block.

repeat num 5 [ print num ]
1
2
3
4
5

Related Words: loop for forall foreach forskip while until


return value

Exit the current user function immediately, returning the value as the result of the function. To return no value, use the EXIT function.

fun: make function! [this-time] [
    if this-time >= 12:00 [ return "after noon" ]
    else [return "before noon" ]
]
print fun 9:00

    print fun 9:00
    
before noon
print fun 18:00
after noon

Related Words: break exit catch shield


same? value value

Returns TRUE if the values are identically the same object, not just in value. For example, a TRUE would be returned if two strings are the same string (occupy the same location in memory).

a: "apple"
b: a
print same? a b
t same? a b
    
true
print same? a "apple"
false


save file value

Save a value to a file or URL, performing the proper conversion and formatting to preserve the datatype. For instance, if the value is a REBOL block, it will be saved as a REBOL script that when loaded would be identical.

save %number 1234
print read %number
%number
    
1234
print load %number
1234

Related Words: load do send


second series

Return the second value of a series. An error will occur if no value is found. Use the PICK function to avoid this error.

print second "REBOL"
E
print second [11 22 33 44 55 66]
22
print second 15-Jun-1999
6
print second 199.4.80.1
4
print second 12:34:56.78
34

Related Words: pick first third fourth fifth


secure options

Control various levels of security used by REBOL.


select series value

Find a value within a series and return the value immediately after it. Otherwise, return NONE. Similar to the FIND function, which returns the beginning of the found value.

blk: [red 123 green 456 blue 789]
print select blk 'red
lk 'red
    
123
print select blk 456
456
    
blue
str: "with all things considered"
print select str "is "
r "is "
    
none
space: first " "
print select str space
r space
    
a

Related Words: find


send where value

Send a message to another computer or process. The first argument can be an email address, message port, or block of such values. The value sent can be any REBOL datatype, but it will be converted to text prior to sending. For email, the message header will be constructed from the default header, unless the value sent is a valid email object, in which case it will be used to create the header.

send test@rebol.com "Printing REBOL Function Summary"

Related Words: load read save


series? value

Return TRUE if the value is a SERIES and FALSE for all other values.

print series? "string"
true
print series? [1 2 3]
false

Related Words: type? string? email? file? url? issue? tuple? block? paren?


set word value /default value

Set a word to a value. If the first argument is a block of words and the value is not a block, all of the words in the block will be set to that value. If the value is a block, then each of the words in the first block will be set to the respective values in the second block. If there are not enough values in the second block, the remaining words will be set to none, unless the /DEFAULT refinement specifies otherwise.

set 'test 1234
print test
nt test
    
1234
set [a b] 123
print a
print a
    
123
print b
t b
    
123
set [d e] [1 2]
print d
print d
    
1
print e
t e
    
2

Related Words: get value? unset


shield before-block main-block after-block

Shield a block from catch and other types of exception handling, allowing it to take the necessary steps to inialize and finalize its state. An advanced function. See the user guide for more info.

print catch 'throw [
    shield [
        print "entering"
    ][
        repeat n 10 [if n > 5 [throw "thrown out"]]
    ][
        print "exiting"
    ]
]
  print "exiting"
        ]
    ]
    
entering
exiting
thrown out

Related Words: break catch


sine number

Return the trigonometric sine value.

print sine 90
1
print (sine 45) = (cosine 45)
true

Related Words: cosine tangent arcsine arccosine arctangent


size? file

Return the size of the contents of a file or URL in bytes.

print size? %reboldoc.r
74334

Related Words: modified? exists?


skip series integer

Return the series at a position forward or backward a number of values. For example, SKIP series 1 is the same as NEXT. If skip attempts to move beyond the head or tail it will be stopped at the head or tail.

str: "REBOL"
print skip str 3
p str 3
    
OL
blk: [11 22 33 44 55]
print skip blk 3
p blk 3
    
44 55 

Related Words: next past index?


sort series

Sort a series in ascending order.

blk: [34 12 934]
print sort blk
 blk
    
12 34 934 


square-root number

Returns the square root of a number.

print square-root 2
1.4142135623730951

Related Words: log-2 log-10 log-e exp


string!

A word used to represent the STRING datatype, both externally to the user and internally within the system. It returns a value that is of the same datatype so it can be used to MAKE new values of that type.

str: make string! 20
insert str "hello"
print str
  print str
    
helloO

Related Words: string? make type?


string? value

Return TRUE if the value is a STRING and FALSE for all other values.

print string? "with all things considered"
true
print string? 123
false

Related Words: string! type?


subtract value value

Subtract the second value from the first. When subtracting values of different datatypes, the values must be compatible.

print subtract 123 1
122
print subtract 1.2.3.4 1.0.3.0
0.2.0.4
print subtract 12:00 11:00
1:00

Related Words: - + add absolute


tail series

Return a series at the position just after its last value. This behavior is needed to allow an insert at the end of a series.

blk: copy [11 22 33]
insert tail blk [44 55 66]
print blk
  print blk
    
11 22 33 44 55 66 

Related Words: tail? head head?


tail? series

Return TRUE if at the tail of a series.

str: "ab"
print tail? tail str
ail str
    
true
print tail? next next str
str
    
true
blk: [1 2]
print tail? tail blk
ail blk
    
true
print tail? next next blk
blk
    
true

Related Words: tail head head?


tangent number

Return the trigonometric tangent value.

print tangent 30
0.5773502691896257

Related Words: sine cosine arcsine arccosine arctangent


third series

Return the third value of a series. An error will occur if no value is found. Use the PICK function to avoid this error.

print third "REBOL"
B
print third [11 22 33 44 55 66]
33
print third 15-Jun-1999
1999
print third 199.4.80.1
80
print third 12:34:56.78
56.78

Related Words: first second fourth fifth pick


time! value

A word used to represent the TIME datatype, both externally to the user and internally within the system. It returns a value that is of the same datatype so it can be used to MAKE new values of that type.

time: make time! [5 30 15] ; hour min sec
print time
nt time
    
5:30:15

Related Words: time? make type?


time? value

Return TRUE if the value is a time and FALSE for all other values.

print time? 12:00
true
print time? 123
false

Related Words: time! type?


trace level

Enable tracing of evaluation. Used for debugging. TRACE TRUE turns it on. TRACE FALSE turns it off.

Related Words: echo


trim string /head /tail /auto

Remove whitespace from the head and tail of a string. The /HEAD and /TAIL refinements can be used to trim only from their respective locations. /AUTO auto trims groups of lines.

str: {
Now is the winter of our discontent made
glorious summer by this sun of York.
}
print trim/auto str
nt trim/auto str
    
Now is the winter of our discontent made
glorious summer by this sun of York.
f York.
    


true

Returns the LOGIC value for TRUE.

if true [print "of course"]
of course

Related Words: false on off yes no


tuple!

A word used to represent the TUPLE datatype, both externally to the user and internally within the system. It returns a value that is of the same datatype so it can be used to MAKE new values of that type.

Related Words: tuple? make type?


tuple? value

Return TRUE if the value is of the TUPLE datatype and FALSE for all other values.

print tuple? 1.2.3.4
true
version: 0.1.0
if tuple? version [ print version ]
rsion ]
    
0.1.0

Related Words: tuple! type?


type? value

Returns the datatype of the value as a literal word. To check for a single datatype, use its datatype test function (e.g. string?, time?)

print type? 10
number!
print type? :type?
pe?
    
function!

Related Words: make none? logic? integer? decimal? fraction? money? tuple? time? date? character? string? email? file? url? issue? word? block? paren? path? native? function? object? port?


unset word

Set a word to an undefined state. Its current value will be lost. The word is passed as a literal. If a block is given, all the words in it will be unset.

test: "a value"
unset 'test
print value? 'test
alue? 'test
    
false

Related Words: set


until block

Evaluate a block until it becomes TRUE (that is, until the last value evaluated in the block is TRUE).

str: "characters"
until [
    print str
    tail? str: next str
]
tr: next str
    ]
    
characters
haracters
aracters
racters
acters
cters
ters
ers
rs
s

Related Words: while repeat for


url!

A word used to represent the URL datatype, both externally to the user and internally within the system. It returns a value that is of the same datatype so it can be used to MAKE new values of that type.

print make url! "http://www.rebol.com"
http://www.rebol.com

Related Words: url? make type?


url? value

Return TRUE if the value is a URL and FALSE for all other values.

print url? http://www.rebol.com
true
print url? "test"
false

Related Words: url! type?


use words block

Defines words to be local variables to a block.

total: 1234
nums: [123 321 456]
use [total] [
    total: 0
    foreach n nums [total: total + n]
    print total
]

        print total
    ]
    
900
print total
1234

Related Words: function! object!


value? word

Return TRUE if the word has a value (it has been set). The word can be passed as a literal, or as the result of other operations.

test: 1234
print value? 'test
? 'test
    
true
print value? first [test this]
is]
    
true


wait value

Wait for a duration or event. If the value is a TIME, delay for that period. If the value is a DATE/TIME, wait until that DATE/TIME. If the value is an INTEGER or DECIMAL, wait that number of seconds. If the value is a PORT, wait for an event from that port. If a block is specified, wait for any of the times or events.

wait 2
wait 0:05   ; five minutes
minutes
    


while block block

Evaluate the second block while the first block evaluates TRUE. BREAK can be used to escape from the block at any point.

str: "characters"
while [ not tail? str: next str ] [
    print [ "length of" str "is" length? str ]
]
h? str ]
    ]
    
length of haracters is 9 
length of aracters is 8 
length of racters is 7 
length of acters is 6 
length of cters is 5 
length of ters is 4 
length of ers is 3 
length of rs is 2 
length of s is 1 

Related Words: loop repeat for until


word!

A word used to represent the WORD datatype, both externally to the user and internally within the system. It returns a value that is of the same datatype so it can be used to MAKE new values of that type.

print make word! "test"
test

Related Words: make type? word?


word? value

Return TRUE if the value is a word. To test for "word:", ":word", or "'word", use the SET?, GET?, and LITERAL? functions.

print word? second [1 two "3"]
true

Related Words: word! type?


write file value /part length /binary /string

Write a string or binary value to a file or URL. Partial writes can be performed with the /PART refinement which specifies a length. The /BINARY refinement forces the result to be binary data, not a string.

write %readme.txt "This is a readme file."

Related Words: read load save


xor value value

A function that returns the first value exclusive ORed with the second. LOGIC values must be different for the result to be TRUE (the same as "<>" NOT EQUAL). For integers, each bit is separately affected.

print 122 xor 1
123
print true xor false
true
print false xor false
false
print 1.2.3.4 xor 1.0.0.0
0.2.3.4


yes

Another word for LOGIC TRUE.

Related Words: true false on off no


zero? number

Return TRUE if the number is zero.

print zero? 50
false
print zero? 0
true

Related Words: positive? negative?


Copyright © REBOL Technologies 1998. REBOL is a trademark of REBOL Technologies. All rights reserved.

WWW.REBOL.COM