Red by Example - an accessible reference by example

Last update on 2016-07-24

index

index     parse     vid     series     help     about     links     contact     

GUI (VID) dialect words in alphanumerical order

across                  all-over                aqua                    area                    
at beige below black
blue bold bottom brick
brown button center center-face
check check-all-reactions check-reactions coal
coffee crimson cyan data
default disabled do draw
drop-down drop-list dump-face event?
extra facet field find-flag?
focus font font-color font-name
font-size forest gold gray
green hidden insert-event-func italic
ivory khaki leaf left
linen link-sub-to-parent link-tabs-to-parent loose
magenta maroon middle mint
navy needs no-wrap offset?
oldrab olive on-alt-down on-alt-up
on-aux-down on-aux-up on-change on-click
on-close on-create on-dbl-click on-detect
on-down on-drag on-drag-start on-drop
on-enter on-face-deep-change* on-focus on-key
on-key-down on-key-up on-menu on-mid-down
on-mid-up on-move on-moving on-over
on-pan on-parse-event on-press-tap on-resize
on-resizing on-rotate on-select on-time
on-two-tap on-unfocus on-up on-zoom
orange origin overlap? pad
papaya para pewter pink
purple radio rate react
reblue rebolor red remove-event-func
remove-reactor return right select
set-flag show size-text slider
space style tab-panel text
text-list top underline update-font-faces
wrap
top alphanumeric-index category-index

Parse dialect words in alphanumerical order

copy                    skip                    
top alphanumeric-index category-index

Red words in alphanumerical order

%                       *                       **                      +                       
- / // <
<< <= <> =
== =? > >=
>> >>> ? ??
a-an about absolute acos
action! action? add all
also alter and and~
any any-block? any-function? any-list?
any-object? any-path? any-string? any-word?
append arccosine arcsine arctangent
arctangent2 as-color as-ipv4 as-pair
as-rgba asin ask at
atan atan2 attempt back
binary! binary? bind bitset!
bitset? block! block? body-of
break browse case catch
cause-error cd change change-dir
char! char? charset checksum
clean-path clear clear-reactions collect
comment complement complement? compose
construct context context? continue
copy cos cosine create-dir
datatype! datatype? debase default-input-completer
dehex difference dir dir?
dirize divide do do-actor
do-events do-file do-safe does
dump-reactions either empty? enbase
equal? error! error? eval-set-path
even? event! exclude exists?
exit exp extend extract
extract-boot-args false fifth file!
file? find first flip-exe-flag
float! float? forall foreach
forever form fourth func
function function! function? get
get-current-dir get-env get-path! get-path?
get-word! get-word? greater-or-equal? greater?
halt has hash! hash?
head head? help if
image! image? in index?
input insert integer! integer?
intersect is issue! issue?
keys-of last last-lf? layout
length? lesser-or-equal? lesser? list-dir
list-env lit-path! lit-path? lit-word!
lit-word? ll load log-10
log-2 log-e logic! logic?
loop lowercase ls make
make-dir map! map? max
min modify modulo mold
move multiply NaN NaN?
native! native? negate negative?
new-line new-line? next no
none none! none? normalize-dir
not not-equal? now number!
object object! object? odd?
off on op! op?
or or~ pad pair!
pair? paren! paren? parse
parse-trace path! path? percent!
percent? pi pick point
point! poke positive? power
prin print probe put
pwd q quit quit-return
quote random react? read
red-complete-file red-complete-path reduce refinement!
refinement? reflect remainder remove
remove-each repeat repend replace
request-dir request-file request-font return
reverse round routine routine!
routine? same? save second
select series! series? set
set-current-dir set-env set-path! set-path?
set-quiet set-word! set-word? shift
shift-left shift-logical shift-right sin
sine skip sort source
space spec-of split split-path
square-root stats strict-equal? string!
string? subtract suffix? swap
switch tail tail? take
tan tangent third throw
time? to to-hex to-image
to-local-file to-red-file trim true
try tuple! tuple? type?
typeset! typeset? union unique
unless unset unset! unset?
until unview uppercase url!
url? value? values-of vector!
vector? view wait what
what-dir while within? word!
word? words-of write xor
xor~ yes zero?
top alphanumeric-index category-index

Master index of categories

Bases of Numbers              Bit manipulation              Boolean                       
Casting Types Comparison Conditional branching
Console Constants Create
Conversion Colors Directories
Documentation Datatypes Error
Evaluation Exiting Events
Files Formatting Functions
GUI (VID) GUI (VID) dialect Help & Debug
Input Iteration Logic
Maps Math Network
Objects Output Parse
Parse dialect Reflection Series
Sets Special Purpose String manipulation
System Related Type Checking Unknown
URL Word Manipulation
top alphanumeric-index category-index

Category: Bases of Numbers

debase                  to-hex                  
top alphanumeric-index category-index

Category: Bit manipulation

<<                      >>                      >>>                     and                     
and~ complement not or
or~ shift shift-left shift-logical
shift-right xor xor~
top alphanumeric-index category-index

Category: Boolean

all                     and                     and~                    any                     
false no none not
off on or or~
true yes
top alphanumeric-index category-index

Category: Casting Types

as-color                as-ipv4                 as-pair                 as-rgba                 
to
top alphanumeric-index category-index

Category: Comparison

<                       <=                      <>                      =                       
== =? > >=
all and and~ any
equal? greater-or-equal? greater? lesser-or-equal?
lesser? negative? not not-equal?
or or~ positive? same?
strict-equal? zero?
top alphanumeric-index category-index

Category: Conditional branching

case                    either                  if                      switch                  
unless
top alphanumeric-index category-index

Category: Console

prin                    print                   probe                   
top alphanumeric-index category-index

Category: Constants

false                   new-line                no                      none                    
on pi space true
yes
top alphanumeric-index category-index

Category: Create

make                    
top alphanumeric-index category-index

Category: Conversion

as-color                as-ipv4                 as-pair                 as-rgba                 
dehex dirize form to
top alphanumeric-index category-index

Category: Colors

aqua                    beige                   black                   blue                    
brick brown coal coffee
crimson cyan forest gold
gray green ivory khaki
leaf linen magenta maroon
mint navy oldrab olive
orange papaya pewter pink
purple reblue rebolor red
as-color
top alphanumeric-index category-index

Category: Directories

change-dir              clean-path              dir                     dir?                    
dirize exists? get-current-dir list-dir
normalize-dir pwd read red-complete-file
red-complete-path request-dir request-file split-path
suffix? to-local-file to-red-file write
top alphanumeric-index category-index

Category: Documentation

?                       ??                      comment                 help                    
source what
top alphanumeric-index category-index

Category: Datatypes

action!                 binary!                 bitset!                 block!                  
char! datatype! error! event!
file! float! function! get-path!
get-word! hash! image! integer!
issue! lit-path! lit-word! logic!
make map! native! none!
number! object! op! pair!
paren! path! percent! point!
refinement! routine! series! set-path!
set-word! string! tuple! typeset!
unset! url! vector! word!
top alphanumeric-index category-index

Category: Error

attempt                 catch                   cause-error             error?                  
throw try
top alphanumeric-index category-index

Category: Evaluation

also                    do                      do-safe                 eval-set-path           
reduce
top alphanumeric-index category-index

Category: Exiting

exit                    halt                    q                       quit                    
quit-return return
top alphanumeric-index category-index

Category: Events

on-alt-down             on-alt-up               on-aux-down             on-aux-up               
on-change on-click on-close on-create
on-dbl-click on-detect on-down on-drag
on-drag-start on-drop on-enter on-face-deep-change*
on-focus on-key on-key-down on-key-up
on-menu on-mid-down on-mid-up on-move
on-moving on-over on-pan on-parse-event
on-press-tap on-resize on-resizing on-rotate
on-select on-time on-two-tap on-unfocus
on-up on-zoom
top alphanumeric-index category-index

Category: Files

cd                      change-dir              clean-path              dir                     
dir? dirize exists? file?
get-current-dir get-path? list-dir ll
load ls normalize-dir path?
read red-complete-file red-complete-path request-dir
request-file save set-current-dir split-path
suffix? to-local-file to-red-file what-dir
write
top alphanumeric-index category-index

Category: Formatting

??                      dehex                   form                    mold                    
pad
top alphanumeric-index category-index

Category: Functions

body-of                 does                    exit                    func                    
function function! has keys-of
native? routine routine! routine?
top alphanumeric-index category-index

Category: GUI (VID)

event?                  do-actor                do-events               layout                  
unview view
top alphanumeric-index category-index

Category: GUI (VID) dialect

across                  all-over                aqua                    area                    
at beige below black
blue bold bottom brick
brown button center center-face
check check-all-reactions check-reactions coal
coffee crimson cyan data
default disabled do draw
drop-down drop-list dump-face extra
facet field find-flag? focus
font font-color font-name font-size
forest gold gray green
hidden insert-event-func italic ivory
khaki leaf left linen
link-sub-to-parent link-tabs-to-parent loose magenta
maroon middle mint navy
needs no-wrap offset? oldrab
olive on-alt-down on-alt-up on-aux-down
on-aux-up on-change on-click on-close
on-create on-dbl-click on-detect on-down
on-drag on-drag-start on-drop on-enter
on-face-deep-change* on-focus on-key on-key-down
on-key-up on-menu on-mid-down on-mid-up
on-move on-moving on-over on-pan
on-parse-event on-press-tap on-resize on-resizing
on-rotate on-select on-time on-two-tap
on-unfocus on-up on-zoom orange
origin overlap? pad papaya
para pewter pink purple
radio rate react reblue
rebolor red remove-event-func remove-reactor
return right select set-flag
show size-text slider space
style tab-panel text text-list
top underline update-font-faces wrap
top alphanumeric-index category-index

Category: Help & Debug

?                       ??                      about                   help                    
source what
top alphanumeric-index category-index

Category: Input

ask                     input                   last-lf?                load                    
read
top alphanumeric-index category-index

Category: Iteration

break                   continue                forall                  foreach                 
forever loop repeat until
while
top alphanumeric-index category-index

Category: Logic

all                     and                     and~                    any                     
not or or~
top alphanumeric-index category-index

Category: Maps

extend                  put                     
top alphanumeric-index category-index

Category: Math

%                       *                       **                      +                       
- / // a-an
absolute acos add arccosine
arcsine arctangent arctangent2 asin
atan atan2 cos cosine
divide even? exp log-10
log-2 log-e max min
modulo multiply NaN NaN?
negate odd? pi power
random remainder round sin
sine square-root subtract tan
tangent within?
top alphanumeric-index category-index

Category: Network

checksum                
top alphanumeric-index category-index

Category: Objects

bind                    construct               context                 extend                  
in object path! path?
top alphanumeric-index category-index

Category: Output

last-lf?                new-line                new-line?               prin                    
print write
top alphanumeric-index category-index

Category: Parse

parse                   parse-trace             
top alphanumeric-index category-index

Category: Parse dialect

copy                    skip                    
top alphanumeric-index category-index

Category: Reflection

keys-of                 reflect                 spec-of                 values-of               
words-of
top alphanumeric-index category-index

Category: Series

alter                   append                  at                      back                    
change clear collect compose
copy empty? exclude extract
fifth find first fourth
head head? index? insert
last length? move next
path! path? pick poke
remove replace reverse second
select skip sort swap
tail tail? take third
unique
top alphanumeric-index category-index

Category: Sets

charset                 difference              intersect               union                   
unique
top alphanumeric-index category-index

Category: Special Purpose

also                    
top alphanumeric-index category-index

Category: String manipulation

alter                   append                  at                      back                    
change clear collect compose
copy empty? exclude extract
fifth find first fourth
head head? index? insert
last length? lowercase move
next pad pick poke
remove replace reverse second
select skip sort split
swap tail tail? third
trim uppercase
top alphanumeric-index category-index

Category: System Related

extract-boot-args       flip-exe-flag           halt                    quit                    
quit-return stats wait
top alphanumeric-index category-index

Category: Type Checking

action?                 any-block?              any-function?           any-list?               
any-object? any-path? any-string? any-word?
binary? bitset? block? char?
complement? context? datatype? dir?
empty? equal? error? file?
float? function? get-path? get-word?
hash? image? integer? issue?
lit-path? lit-word? logic? map?
native? new-line? none? not-equal?
object? op? pair? paren?
path? percent? point refinement?
routine? same? series? set-path?
set-word? string? tuple? type?
typeset? url? value? vector?
word?
top alphanumeric-index category-index

Category: Unknown

browse                  clear-reactions         create-dir              default-input-completer 
do-file dump-reactions enbase get-env
list-env make-dir modify now
react? remove-each repend request-font
routine set-env set-quiet time?
to-image
top alphanumeric-index category-index

Category: URL

path!                   path?                   read                    url!                    
url?
top alphanumeric-index category-index

Category: Word Manipulation

get                     quote                   set                     unset                   
unset! unset?
top alphanumeric-index category-index

Red word:    %    type=op!

Categories to which this word belongs: Math

Description
The infix word % returns what is left over when argument 1 is divided 
by argument 2.

Arguments can have those types:
number! char! pair! tuple! vector! time!
Examples
red>> 3 % 2
== 1

red>> 3.5 % 2
== 1.5

red>> 3.6 % 2.2
== 1.4

red>> 11x19 % 3
== 2x1

red>> 11x19 % 3x4
== 2x3
top alphanumeric-index category-index

Red word:    *    type=op!

Categories to which this word belongs: Math

Description
The infix word * multiplies its two operands.
It is the equivalent of the multiply function.

It operates on these types:
number! char! pair! tuple! vector!

In Red, infix operators are evaluated from left to right, with no precedence.
You may use parentheses ( ) to change the order of evaluation.

The word * is a Red word and thus needs to be separated by whitespace.

In general, the type of the result is the same type as the first operand,
where this is sensible. Errors will result when the types are incompatible.

Note the result when vectors of different lengths are multiplied.

When we multiply two vector!s, the result is a freshly allocated vector!.

When we multiply a vector! with a number!, the original vector!
will be modified.
Examples
red>> 2 * 3.7
== 7.4

red>> 3 * 1.4.8
== 1.12.8

red>> 4 * 10x20
== 40x80

red>> v1: make vector![2 3 4 5]
== make vector! [2 3 4 5]

red>> v2: make vector! [22 55]
== make vector! [22 55]

red>> v1 * v2
== make vector! [44 165]

red>> v1
== make vector! [2 3 4 5]
; v1 unchanged

red>> v1 * 9
== make vector! [18 27 36 45]

red>> v1
== make vector! [18 27 36 45]
; v1 changed

red>> 3 * v1
*** Script error: vector type is not allowed here
*** Where: *
top alphanumeric-index category-index

Red word:    **    type=op!

Categories to which this word belongs: Math

Description
The infix word ** raises argument 1 to the power argument 2.
Examples
red>> 2 ** 2
== 4

red>> 2 ** 10
== 1024

red>> 2 ** -1
== 0.5

red>> 2 ** -10
== 0.0009765625

red>> -2 ** 4
== 16

red>> -2 ** 3
== -8

red>> 2 ** 0.5
== 1.414213562373095

red>> 2 ** -0.5
== 0.7071067811865476
top alphanumeric-index category-index

Red word:    +    type=op!

Categories to which this word belongs: Math

Description
The infix word + adds its two operands.
It is the equivalent of the add function.

It operates on these types:
number! char! pair! tuple! vector!

In Red, infix operators are evaluated from left to right, with no precedence.
You may use parentheses ( ) to change the order of evaluation.

In general, the type of the result is the same type as the first operand,
where this is sensible. Errors will result when the types are incompatible.
See examples.

Note the result when vectors of different lengths are added.

The operator + is a Red word and thus needs to be separated by whitespace.

When we add two vector!s, the result is a freshly allocated vector!.
When we add a number! to a vector!, the original vector! will be modified.
Examples
red>> 1 + 3.7
== 4.7

red>> 3 + 100x200
== 103x203

red>> v1: make Vector![3 2 1 4]
== make vector! [3 2 1 4]

red>> v2: make vector![100 200]
== make vector! [100 200]

red>> v1 + v2
== make vector! [103 202]

red>> v1
== make vector! [3 2 1 4]
; v1 unchanged

red>> v2 + v1
== make vector! [103 202]

red>> v1 - 22
== make vector! [-19 -20 -21 -18]
; v1 altered

red>> v1
== make vector! [-19 -20 -21 -18]

red>> 3 + v1
*** Script error: vector type is not allowed here
*** Where: +
top alphanumeric-index category-index

Red word:    -    type=op!

Categories to which this word belongs: Math

Description
The infix operator - subtracts its second operand from its first operand.
It is the equivalent of the subtract function.

It operates on these types:
number! char! pair! tuple! vector!

In Red, infix operators are evaluated from left to right, with no precedence.
You may use parentheses ( ) to change the order of evaluation.

The operator - is a Red word and thus needs to be separated by whitespace.

In general, the type of the result is the same type as the first operand,
where this is sensible. Errors will result when the types are incompatible.

Note the result when vectors of different lengths are subtracted.

When we subtract 2 vectors, the result is a freshly allocated vector.
When we subtract a number from a vector, the original vector will be modified.
Examples
; -------------------------------------------------------------------------
; Subtract float! from integer!
; -------------------------------------------------------------------------

red>> 3 - 1.4
1.6

; -------------------------------------------------------------------------
; Subtract pair! from integer! not possible
; -------------------------------------------------------------------------

red>> 3 - 100x100
*** Script error: - does not allow pair for its value2 argument
*** Where: -

; -------------------------------------------------------------------------
; Subtract integer! from pair! is possible
; -------------------------------------------------------------------------

red>> 100x200 - 3
== 97x197

; -------------------------------------------------------------------------
; Subtract vector!s
; -------------------------------------------------------------------------

red>> v1: make vector! [3 2 1 4]
== make vector! [3 2 1 4]

red>> v2: make vector! [100 200]
== make vector! [100 200]

red>> v1 - v2
== make vector! [-97 -198]

red>> v2 - v1
== make vector! [97 198]

red>> v2
== make vector! [100 200]
; v2 is unchanged

red>> v1 - 22
== make vector! [-19 -20 -21 -18]

red>> v1
== make vector! [-19 -20 -21 -18]
; v1 is altered!

red>> 22 - v1
*** Script error: vector type is not allowed here
*** Where: -
top alphanumeric-index category-index

Red word:    /    type=op!

Categories to which this word belongs: Math

Description
The infix word / divides its operands giving a quotient.
It is the equivalent of the divide function.

It operates on these types:
number! char! pair! tuple! vector!

In Red, infix operators are evaluated from left to right, with no precedence.
You may use parentheses ( ) to change the order of evaluation.

/ is a Red word and thus needs to be separated by whitespace.

When one of the operands is a float!, the result is a float!.

When both operands are integer!, the result is integer!,
truncated towards zero.

Otherwise, the type of the result is the same type as the first operand,
where this is sensible. Errors will result when the types are incompatible.

Note the result when vector!s of different lengths are divided.

When we divide two vector!s, the result is a freshly allocated vector!.
When we divide a vector! by a number!, the original vector! will be modified.
Examples
red>> 9 / 3
== 3

red>> 9.0 / 3
== 3.0

red>> 10 / 11
== 0

red>> -11 / 4
== -2

red>> 100x30 / 5
== 20x6

red>> 100x40 / 2x4
== 50x10

red>> 3.9.19 / 3
== 1.3.6

red>> v1: make vector![100 200 300 400]
== make vector! [100 200 300 400]

red>> v2: make vector![5 5 10]
== make vector! [5 5 10]

red>> v1 / v2
== make vector! [20 40 30]

red>> v1
== make vector! [100 200 300 400]
; v1 unchanged

red>> v1 / 5
== make vector! [20 40 60 80]

red>> v1
== make vector! [20 40 60 80]
; v1 changed

red>> 5 / v1
*** Script error: vector type is not allowed here
*** Where: /
top alphanumeric-index category-index

Red word:    //    type=op!

Categories to which this word belongs: Math

Description
The infix word // is the nonnegative remainder oparator,
that returns what is left over when the first argument is divided
by the second.

Has two arguments of type:
number! char! pair! tuple! vector!

There is also a functional version, named remainder.

If the first argument is positive, then the remainder is positive.

If the first argument is negative, then the remainder is also positive,
as in -5 // 4, which results in 3.

If the first argument is zero, then the remainder is also zero.

If the second argument is zero, a run-time error occurs.
Examples
red>> 5 // 4
== 1
red>> 5 // 5
== 0
red>> 5 // 6
== 5
red>> -5 // 4
== 3
red>> 10 // 3.3
== 0.1000000000000005
red>> 5x10 // 4
*** Internal error: reserved for future use (or not yet implemented)
*** Where: >
red>> remainder 5x10 4
== 1x2
red>> make vector![5 5 10] // 4
*** Script error: % does not allow block for its value1 argument
*** Where: %
top alphanumeric-index category-index

Red word:    across    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

Description
The VID dialect word across is used to position GUI elements following that
word at the right hand side of the previous GUI element.
Examples
Red [
needs: 'view
]

view [
across
text "Line 1"
text "Line 2"
]

vid-across.png
top alphanumeric-index category-index

Red word:    all-over    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    aqua    type="GUI (VID) dialect"!

Categories to which this word belongs: Colors, GUI (VID) dialect

Description
The VID dialect word aqua is a color that can be used for GUI elements.

It is a tuple! of value 40.100.130
Examples
view [
text 100x50 aqua " "
]

vid-aqua.png
top alphanumeric-index category-index

Red word:    area    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    at    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    beige    type="GUI (VID) dialect"!

Categories to which this word belongs: Colors, GUI (VID) dialect

Description
The VID dialect word beige is a color that can be used for GUI elements.

It is a tuple! of value 255.228.196
Examples
view [
text 100x50 beige " "
]

vid-beige.png
top alphanumeric-index category-index

Red word:    below    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

Description
The function below is used to position GUI elements following that
word below the previous GUI element.
Examples
Red [
needs: 'view
]

view [
below
text "Line 1"
text "Line 2"
]

vid-below.png
top alphanumeric-index category-index

Red word:    black    type="GUI (VID) dialect"!

Categories to which this word belongs: Colors, GUI (VID) dialect

Description
The VID dialect word black is a color that can be used for GUI elements.

It is a tuple! of value 0.0.0
Examples
view [
text 100x50 black " "
]

vid-black.png
top alphanumeric-index category-index

Red word:    blue    type="GUI (VID) dialect"!

Categories to which this word belongs: Colors, GUI (VID) dialect

Description
The VID dialect word blue is a color that can be used for GUI elements.

It is a tuple! of value 0.0.255
Examples
view [
text 100x50 blue " "
]

vid-blue.png
top alphanumeric-index category-index

Red word:    bold    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    bottom    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    brick    type="GUI (VID) dialect"!

Categories to which this word belongs: Colors, GUI (VID) dialect

Description
The VID dialect word brick is a color that can be used for GUI elements.

It is a tuple! of value 178.34.34
Examples
view [
text 100x50 brick " "
]

vid-brick.png
top alphanumeric-index category-index

Red word:    brown    type="GUI (VID) dialect"!

Categories to which this word belongs: Colors, GUI (VID) dialect

Description
The VID dialect word brown is a color that can be used for GUI elements.

It is a tuple! of value 139.69.19
Examples
view [
text 100x50 brown " "
]

vid-brown.png
top alphanumeric-index category-index

Red word:    button    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

Description
The VID dialect word button is a widget (a GUI element).

A button can have several properties:
- text
- image

A button has associated actions like:
- on-down (mouse pressed)
- on-up (mouse released)
- on-click (mouse pressed)
- on-over (mouse hovers over the button)

For comprehensive documentation on VID look here: vid.

Examples
Red [
needs: 'view
]

view [
button blue 300x30 "Click Me!"
on-up [print "Mouse up!"]
on-down [print "Mouse down!"]
on-click [print "Mouse clicked!"]
on-over [print "Mouse over me!"]
]
top alphanumeric-index category-index

Red word:    center    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    center-face    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    check    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    check-all-reactions    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    check-reactions    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    coal    type="GUI (VID) dialect"!

Categories to which this word belongs: Colors, GUI (VID) dialect

Description
The VID dialect word coal is a color that can be used for GUI elements.

It is a tuple! of value 64.64.64
Examples
view [
text 100x50 coal " "
]

vid-coal.png
top alphanumeric-index category-index

Red word:    coffee    type="GUI (VID) dialect"!

Categories to which this word belongs: Colors, GUI (VID) dialect

Description
The VID dialect word coffee is a color that can be used for GUI elements.

It is a tuple! of value 76.26.0
Examples
view [
text 100x50 coffee " "
]

vid-coffee.png
top alphanumeric-index category-index

Red word:    crimson    type="GUI (VID) dialect"!

Categories to which this word belongs: Colors, GUI (VID) dialect

Description
The VID dialect word crimson is a color that can be used for GUI elements.

It is a tuple! of value 220.20.60
Examples
view [
text 100x50 crimson " "
]

vid-crimson.png
top alphanumeric-index category-index

Red word:    cyan    type="GUI (VID) dialect"!

Categories to which this word belongs: Colors, GUI (VID) dialect

Description
The VID dialect word cyan is a color that can be used for GUI elements.

It is a tuple! of value 0.255.255
Examples
view [
text 100x50 cyan " "
]

vid-cyan.png
top alphanumeric-index category-index

Red word:    data    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    default    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    disabled    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    do    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    draw    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    drop-down    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    drop-list    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    dump-face    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    event?    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID)

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    extra    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    facet    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    field    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    find-flag?    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    focus    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    font    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    font-color    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    font-name    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    font-size    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    forest    type="GUI (VID) dialect"!

Categories to which this word belongs: Colors, GUI (VID) dialect

Description
The VID dialect word forest is a color that can be used for GUI elements.

It is a tuple! of value 0.48.0
Examples
view [
text 100x50 forest " "
]

vid-forest.png
top alphanumeric-index category-index

Red word:    gold    type="GUI (VID) dialect"!

Categories to which this word belongs: Colors, GUI (VID) dialect

Description
The VID dialect word gold is a color that can be used for GUI elements.

It is a tuple! of value 255.205.40
Examples
view [
text 100x50 gold " "
]

vid-gold.png
top alphanumeric-index category-index

Red word:    gray    type="GUI (VID) dialect"!

Categories to which this word belongs: Colors, GUI (VID) dialect

Description
The VID dialect word gray is a color that can be used for GUI elements.

It is a tuple! of value 128.128.128
Examples
view [
text 100x50 gray " "
]

vid-gray.png
top alphanumeric-index category-index

Red word:    green    type="GUI (VID) dialect"!

Categories to which this word belongs: Colors, GUI (VID) dialect

Description
The VID dialect word green is a color that can be used for GUI elements.

It is a tuple! of value 0.255.0
Examples
view [
text 100x50 green " "
]

vid-green.png
top alphanumeric-index category-index

Red word:    hidden    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    insert-event-func    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    italic    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    ivory    type="GUI (VID) dialect"!

Categories to which this word belongs: Colors, GUI (VID) dialect

Description
The VID dialect word ivory is a color that can be used for GUI elements.

It is a tuple! of value 255.255.240
Examples
view [
text 100x50 ivory " "
]

vid-ivory.png
top alphanumeric-index category-index

Red word:    khaki    type="GUI (VID) dialect"!

Categories to which this word belongs: Colors, GUI (VID) dialect

Description
The VID dialect word khaki is a color that can be used for GUI elements.

It is a tuple! of value 179.179.126
Examples
view [
text 100x50 khaki " "
]

vid-khaki.png
top alphanumeric-index category-index

Red word:    leaf    type="GUI (VID) dialect"!

Categories to which this word belongs: Colors, GUI (VID) dialect

Description
The VID dialect word leaf is a color that can be used for GUI elements.

It is a tuple! of value 0.128.0
Examples
view [
text 100x50 leaf " "
]

vid-leaf.png
top alphanumeric-index category-index

Red word:    left    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    linen    type="GUI (VID) dialect"!

Categories to which this word belongs: Colors, GUI (VID) dialect

Description
The VID dialect word linen is a color that can be used for GUI elements.

It is a tuple! of value 250.240.230
Examples
view [
text 100x50 linen " "
]

vid-linen.png
top alphanumeric-index category-index
Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index
Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    loose    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    magenta    type="GUI (VID) dialect"!

Categories to which this word belongs: Colors, GUI (VID) dialect

Description
The VID dialect word magenta is a color that can be used for GUI elements.

It is a tuple! of value 255.0.255
Examples
view [
text 100x50 magenta " "
]

vid-magenta.png
top alphanumeric-index category-index

Red word:    maroon    type="GUI (VID) dialect"!

Categories to which this word belongs: Colors, GUI (VID) dialect

Description
The VID dialect word maroon is a color that can be used for GUI elements.

It is a tuple! of value 128.0.0
Examples
view [
text 100x50 maroon " "
]

vid-maroon.png
top alphanumeric-index category-index

Red word:    middle    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    mint    type="GUI (VID) dialect"!

Categories to which this word belongs: Colors, GUI (VID) dialect

Description
The VID dialect word mint is a color that can be used for GUI elements.

It is a tuple! of value 100.136.116
Examples
view [
text 100x50 mint " "
]

vid-mint.png
top alphanumeric-index category-index

Red word:    navy    type="GUI (VID) dialect"!

Categories to which this word belongs: Colors, GUI (VID) dialect

Description
The VID dialect word navy is a color that can be used for GUI elements.

It is a tuple! of value 0.0.128
Examples
view [
text 100x50 navy " "
]

vid-navy.png
top alphanumeric-index category-index

Red word:    needs    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

Description
The get-word needs is needed in the header block of a Red program
when you are going to use VID, the graphical interface manager.

Note the quote preceding the word view.
Examples
Red [
title: "Create a GUI program"
needs: 'view
]
top alphanumeric-index category-index

Red word:    no-wrap    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    offset?    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    oldrab    type="GUI (VID) dialect"!

Categories to which this word belongs: Colors, GUI (VID) dialect

Description
The VID dialect word oldrab is a color that can be used for GUI elements.

It is a tuple! of value 72.72.16
Examples
view [
text 100x50 oldrab " "
]

vid-oldrab.png
top alphanumeric-index category-index

Red word:    olive    type="GUI (VID) dialect"!

Categories to which this word belongs: Colors, GUI (VID) dialect

Description
The VID dialect word olive is a color that can be used for GUI elements.

It is a tuple! of value 128.128.0
Examples
view [
text 100x50 olive " "
]

vid-olive.png
top alphanumeric-index category-index

Red word:    on-alt-down    type="GUI (VID) dialect"!

Categories to which this word belongs: Events, GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    on-alt-up    type="GUI (VID) dialect"!

Categories to which this word belongs: Events, GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    on-aux-down    type="GUI (VID) dialect"!

Categories to which this word belongs: Events, GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    on-aux-up    type="GUI (VID) dialect"!

Categories to which this word belongs: Events, GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    on-change    type="GUI (VID) dialect"!

Categories to which this word belongs: Events, GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    on-click    type="GUI (VID) dialect"!

Categories to which this word belongs: Events, GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    on-close    type="GUI (VID) dialect"!

Categories to which this word belongs: Events, GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    on-create    type="GUI (VID) dialect"!

Categories to which this word belongs: Events, GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    on-dbl-click    type="GUI (VID) dialect"!

Categories to which this word belongs: Events, GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    on-detect    type="GUI (VID) dialect"!

Categories to which this word belongs: Events, GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    on-down    type="GUI (VID) dialect"!

Categories to which this word belongs: Events, GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    on-drag    type="GUI (VID) dialect"!

Categories to which this word belongs: Events, GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    on-drag-start    type="GUI (VID) dialect"!

Categories to which this word belongs: Events, GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    on-drop    type="GUI (VID) dialect"!

Categories to which this word belongs: Events, GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    on-enter    type="GUI (VID) dialect"!

Categories to which this word belongs: Events, GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    on-face-deep-change*    type="GUI (VID) dialect"!

Categories to which this word belongs: Events, GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    on-focus    type="GUI (VID) dialect"!

Categories to which this word belongs: Events, GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    on-key    type="GUI (VID) dialect"!

Categories to which this word belongs: Events, GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    on-key-down    type="GUI (VID) dialect"!

Categories to which this word belongs: Events, GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    on-key-up    type="GUI (VID) dialect"!

Categories to which this word belongs: Events, GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    on-menu    type="GUI (VID) dialect"!

Categories to which this word belongs: Events, GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    on-mid-down    type="GUI (VID) dialect"!

Categories to which this word belongs: Events, GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    on-mid-up    type="GUI (VID) dialect"!

Categories to which this word belongs: Events, GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    on-move    type="GUI (VID) dialect"!

Categories to which this word belongs: Events, GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    on-moving    type="GUI (VID) dialect"!

Categories to which this word belongs: Events, GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    on-over    type="GUI (VID) dialect"!

Categories to which this word belongs: Events, GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    on-pan    type="GUI (VID) dialect"!

Categories to which this word belongs: Events, GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    on-parse-event    type="GUI (VID) dialect"!

Categories to which this word belongs: Events, GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    on-press-tap    type="GUI (VID) dialect"!

Categories to which this word belongs: Events, GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    on-resize    type="GUI (VID) dialect"!

Categories to which this word belongs: Events, GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    on-resizing    type="GUI (VID) dialect"!

Categories to which this word belongs: Events, GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    on-rotate    type="GUI (VID) dialect"!

Categories to which this word belongs: Events, GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    on-select    type="GUI (VID) dialect"!

Categories to which this word belongs: Events, GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    on-time    type="GUI (VID) dialect"!

Categories to which this word belongs: Events, GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    on-two-tap    type="GUI (VID) dialect"!

Categories to which this word belongs: Events, GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    on-unfocus    type="GUI (VID) dialect"!

Categories to which this word belongs: Events, GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    on-up    type="GUI (VID) dialect"!

Categories to which this word belongs: Events, GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    on-zoom    type="GUI (VID) dialect"!

Categories to which this word belongs: Events, GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    orange    type="GUI (VID) dialect"!

Categories to which this word belongs: Colors, GUI (VID) dialect

Description
The VID dialect word orange is a color that can be used for GUI elements.

It is a tuple! of value 255.150.10
Examples
view [
text 100x50 orange " "
]

vid-orange.png
top alphanumeric-index category-index

Red word:    origin    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    overlap?    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    pad    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    papaya    type="GUI (VID) dialect"!

Categories to which this word belongs: Colors, GUI (VID) dialect

Description
The VID dialect word papaya is a color that can be used for GUI elements.

It is a tuple! of value 255.80.37
Examples
view [
text 100x50 papaya " "
]

vid-papaya.png
top alphanumeric-index category-index

Red word:    para    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    pewter    type="GUI (VID) dialect"!

Categories to which this word belongs: Colors, GUI (VID) dialect

Description
The VID dialect word pewter is a color that can be used for GUI elements.

It is a tuple! of value 170.170.170
Examples
view [
text 100x50 pewter " "
]

vid-pewter.png
top alphanumeric-index category-index

Red word:    pink    type="GUI (VID) dialect"!

Categories to which this word belongs: Colors, GUI (VID) dialect

Description
The VID dialect word pink is a color that can be used for GUI elements.

It is a tuple! of value 255.164.200
Examples
view [
text 100x50 pink " "
]

vid-pink.png
top alphanumeric-index category-index

Red word:    purple    type="GUI (VID) dialect"!

Categories to which this word belongs: Colors, GUI (VID) dialect

Description
The VID dialect word purple is a color that can be used for GUI elements.

It is a tuple! of value 128.0.128
Examples
view [
text 100x50 purple " "
]

vid-purple.png
top alphanumeric-index category-index

Red word:    radio    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    rate    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    react    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    reblue    type="GUI (VID) dialect"!

Categories to which this word belongs: Colors, GUI (VID) dialect

Description
The VID dialect word reblue is a color that can be used for GUI elements.

It is a tuple! of value 38.58.108
Examples
view [
text 100x50 reblue " "
]

vid-reblue.png
top alphanumeric-index category-index

Red word:    rebolor    type="GUI (VID) dialect"!

Categories to which this word belongs: Colors, GUI (VID) dialect

Description
The VID dialect word rebolor is a color that can be used for GUI elements.

It is a tuple! of value 142.128.110
Examples
view [
text 100x50 rebolor " "
]

vid-rebolor.png
top alphanumeric-index category-index

Red word:    red    type="GUI (VID) dialect"!

Categories to which this word belongs: Colors, GUI (VID) dialect

Description
The VID dialect word red is a color that can be used for GUI elements.

It is a tuple! of value 255.0.0
Examples
view [
text 100x50 red " "
]

vid-red.png
top alphanumeric-index category-index

Red word:    remove-event-func    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    remove-reactor    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    return    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

Description
The VID dialect word !return is used to position the next GUI
elements from the left side of the window.
Examples
Red [
needs: 'view
]

view [
across
text "Line 1"
text "Line 2"
return
text "Line 3"
]

vid-return.png
top alphanumeric-index category-index

Red word:    right    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    select    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    set-flag    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    show    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    size-text    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    slider    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    space    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    style    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    tab-panel    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    text    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    text-list    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    top    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    underline    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    update-font-faces    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    wrap    type="GUI (VID) dialect"!

Categories to which this word belongs: GUI (VID) dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    copy    type="Parse dialect"!

Categories to which this word belongs: Parse dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    skip    type="Parse dialect"!

Categories to which this word belongs: Parse dialect

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    <    type=op!

Categories to which this word belongs: Comparison

Description
The infix word < loosely compares operands on its left and right side and
returns true if the operand on the left is smaller than the operand on the right.
Otherwise returns false.

Has 2 operands of any datatype!.

Loose comparison means that:
- the case of strings is ignored when comparing
- same numeric values for different datatypes are considered equal
Examples
2 < 3
== true

2 < 2.0
== false

22-03-2000 < 14-04-2012
== true

"ABC" < "abc"
== false

"abc" < "ABC"
== false

"abc" = "ABC"
== true
top alphanumeric-index category-index

Red word:    <<    type=op!

Categories to which this word belongs: Bit manipulation

Description
The word << shifts its first argument (an integer!) to the left
by the number of bits in its second argument (also an integer!).

The sign is taken into account.
Examples
red>> to-hex 6
== #00000006

red>> to-hex 6 << 1
== #0000000C

red>> to-hex 6 << 2
== #00000018

red>> to-hex 6 << 3
== #00000030

red>> to-hex 6 << 4
== #00000060

red>> to-hex -6
== #FFFFFFFA

red>> to-hex -6 << 1
== #FFFFFFF4

red>> to-hex -6 << 2
== #FFFFFFE8

red>> to-hex -6 << 3
== #FFFFFFD0

red>> to-hex -6 << 4
== #FFFFFFA0
top alphanumeric-index category-index

Red word:    <=    type=op!

Categories to which this word belongs: Comparison

Description
The infix word <= loosely compares operands on its left and right side and
returns true if the operand on the left is smaller than or equal to the operand
on the right. Otherwise returns false.

Has 2 operands of any datatype!.

Loose comparison means that:
- the case of strings is ignored when comparing
- same numeric values for different datatypes are considered equal
Examples
2 <= 3
== true

2 <= 2.0
== true

22-03-2000 <= 14-04-2012
== true

"ABC" <= "abc"
== true

"abc" <= "ABC"
== true
top alphanumeric-index category-index

Red word:    <>    type=op!

Categories to which this word belongs: Comparison

Description
The infix word <> compares 2 values, and returns true if they are
NOT equal, otherwise false.

The 2 values need not be of the same datatype!.
It is equivalent to the not-equal? function.

Note that string! values which only differ in case are considered equal.

Red also has a strict-equal? function, where the types must be the same,
and string! case is checked.
Examples
red>> a: 33
== 33

red>> a <> 35
== true

red>> b: [1 2 3]
== [1 2 3]

red>> b <> [1 2 3]
== false

red>> 12 <> 12.0
== false

red>> "abc" <> "abc"
== false

red>> "abC" <> "ABC"
== false
; Note uppercase considered equal to lowercase!
top alphanumeric-index category-index

Red word:    =    type=op!

Categories to which this word belongs: Comparison

Description
The infix word = loosely compares operands on its left and right side and
returns true if the operand on the left is loosely equal to the operand on the
right. Otherwise returns false.

Has 2 operands of any datatype!.

Loose comparison means that:
- the case of strings is ignored when comparing
- same numeric values for different datatypes are considered equal
Examples
2 = 3
== false

2 = 2.0
== true

22-03-2000 = 14-04-2012
== false

"ABC" = "abc"
== true
top alphanumeric-index category-index

Red word:    ==    type=op!

Categories to which this word belongs: Comparison

Description
The infix word == strictly compares operands on its left and right side and
returns true if the operand on the left is strictly equal to the operand on the
right. Otherwise returns false.

Has 2 operands of any datatype!.

The comparison is "strict", which means that:
- numeric operands are not equal if they have a different datatype
- string operands are not equal if their case differs
Examples
2 == 3
== false

2 == 2.0
== false

22-03-2000 == 14-04-2012
== false

"ABC" == "abc"
== false
top alphanumeric-index category-index

Red word:    =?    type=op!

Categories to which this word belongs: Comparison

Description
The infix word =? returns true if two values have the same identity.

As regards series! (including string!s) the references (pointers) to
the series! are compared.
Examples
red>> a: 22
== 22

red>> b: 22
== 22

red>> a =? b
== true

red>> c: [1 2 3]
== [1 2 3]

red>> d: c
== [1 2 3]

red>> c =? d
== true
; Pointers are compared - they indeed reference the same series

red>> c: [3 2 1]
== [3 2 1]

red>> d: [3 2 1]
== [3 2 1]

red>> c = d
== true
; Values are compared - are equal

red>> c =? d
== false
; Pointers are compared - not referencing the same series
top alphanumeric-index category-index

Red word:    >    type=op!

Categories to which this word belongs: Comparison

Description
The infix word > loosely compares operands on its left and right side
returns true if the operand on the left is greater than the operand on
the right. Otherwise returns false.

Has 2 operands of any datatype

Loose comparison means that:
- the case of strings is ignored when comparing
- same numeric values for different datatypes are considered equal
Examples
Examples

2 > 3
== false

2 > 2.0
== false

22-03-2000 > 14-04-2012
== false

"ABC" > "abc"
== false

"abc" > "ABC"
== false

"abc" = "ABC"
== true
top alphanumeric-index category-index

Red word:    >=    type=op!

Categories to which this word belongs: Comparison

Description
The infix word >= loosely compares operands on its left and right side and
returns true if the operand on the left is greater than or equal to the operand
on the right. Otherwise returns false.

Has 2 operands of any datatype!.

Loose comparison means that:
- the case of strings is ignored when comparing
- same numeric values for different datatypes are considered equal
Examples
2 >= 3
== false

2 >= 2.0
== true

22-03-2000 >= 14-04-2012
== false

"ABC" >= "abc"
== true

"abc" >= "ABC"
== true
top alphanumeric-index category-index

Red word:    >>    type=op!

Categories to which this word belongs: Bit manipulation

Description
The word >> shifts its first argument (an integer!) to the right
by the number of bits in its second argument (also an integer!).

The sign is taken into account.
Examples
red>> to-hex 6
== #00000006

red>> to-hex 6 >> 1
== #00000003

red>> to-hex 6 >> 2
== #00000001

red>> to-hex 6 >> 3
== #00000000

red>> to-hex 6 >> 4
== #00000000

red>> to-hex -6
== #FFFFFFFA

red>> to-hex -6 >> 1
== #FFFFFFFD

red>> to-hex -6 >> 2
== #FFFFFFFE

red>> to-hex -6 >> 3
== #FFFFFFFF

red>> to-hex -6 >> 4
== #FFFFFFFF
top alphanumeric-index category-index

Red word:    >>>    type=op!

Categories to which this word belongs: Bit manipulation

Description
The word >>> shifts its first argument (an integer!) to the right
by the number of bits in its second argument (also an integer!).

This is a shift which ignores the sign.
Examples
red>> to-hex 6
== #00000006

red>> to-hex 6 >>> 1
== #00000003

red>> to-hex 6 >>> 2
== #00000001

red>> to-hex 6 >>> 3
== #00000000

red>> to-hex 6 >>> 4
== #00000000

red>> to-hex -6
== #FFFFFFFA

red>> to-hex -6 >>> 1
== #7FFFFFFD

red>> to-hex -6 >>> 2
== #3FFFFFFE

red>> to-hex -6 >>> 3
== #1FFFFFFF

red>> to-hex -6 >>> 4
== #0FFFFFFF
top alphanumeric-index category-index

Red word:    ?    type=function!

This word is a synonym for help
top alphanumeric-index category-index

Red word:    ??    type=function!

Categories to which this word belongs: Documentation, Formatting, Help & Debug

Description
The word ?? prints a Red word! (given as its argument)
and the value it refers to, in a molded format. This means that
the output includes type information (e.g. [ ], " ").

It is very useful for debugging.

Warning: when used with a function! name, it displays the
function! specification, rather than evaluating
that function!.
Examples
red>> age: 35
== 35

red>> ?? age
age: 35
== 35

red>> older: 1 + ?? age
age: 35
== 36

red>> ?? 44
*** Script error: ?? does not allow integer for its value argument
*** Where: ??

red>> ?? sin 0.4
sin: routine ["Returns the trigonometric sine" angle [float!]
"Angle in radians"][natives/sine* no 1]
== 0.4
; Effectively the 0.4 here is a stand-alone value;
; ?? does not do anything with it!
top alphanumeric-index category-index

Red word:    a-an    type=function!

Categories to which this word belongs: Math

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    about    type=function!

Categories to which this word belongs: Help & Debug

Description
Displays the version of Red currently in use

Has no parameters
Examples
about
Red 0.5.4 - 1-Dec-2015/11:46:16+1:00
top alphanumeric-index category-index

Red word:    absolute    type=action!

Categories to which this word belongs: Math

Description
The absolute word evaluates an expression or a value 
and returns the absolute value if the datatype is appropriate.

Has 1 parameter, an expression or a value
Examples
absolute 1 - 3
== 2
; 1 - 3 == -2
; Returns the absolute value of -2, which is 2

absolute -2 / 5
== 0.4
; -2 / 5 == -0.4
; Returns the absolute value of -0.4, which is 0.4

absolute 6 / 3
== 2
; 6 / 3 == 2
; Returns the absolute value of 2, which is 2

absolute -2x5
== 2x5
top alphanumeric-index category-index

Red word:    acos    type=routine!

This word is a synonym for arccosine
top alphanumeric-index category-index

Red word:    action!    type=datatype!

Categories to which this word belongs: Datatypes

Description
The datatype! action! encompassess a specific set of native!
functions.
Examples
; -------------------------------------------------------------------------
; List all functionss that are an action
; -------------------------------------------------------------------------
red>> ? action!
absolute => Returns the non-negative value
add => Returns the sum of the two values
and~ => Returns the first value ANDed with the second
append => Inserts value(s) at series tail; returns series head
at => Returns a series at a given index
back => Returns a series at the previous index
change => Changes a value in a series and returns the series after
the change.
clear => Removes series values from current index to tail; returns
new tail
complement => Returns the opposite (complementing) value of the input `
value
copy => Returns a copy of a non-scalar value
divide => Returns the quotient of two values
even? => Returns true if the number is evenly divisible by 2
find => Returns the series where a value is found, or NONE
form => Returns a user-friendly string representation of a value
head => Returns a series at its first index
head? => Returns true if a series is at its first index
index? => Returns the current index of series relative to the head,
or of word in a context
insert => Inserts value(s) at series index; returns series past the
insertion
length? => Returns the number of values in the series, from the current
index to the tail
make => Returns a new value made from a spec for that value's type
modify => Change mode for target aggregate value
mold => Returns a source format string representation of a value
move => Moves one or more elements from one series to another
position or series
multiply => Returns the product of two values
negate => Returns the opposite (additive inverse) value
next => Returns a series at the next index
odd? => Returns true if the number has a remainder of 1 when divided
by 2
or~ => Returns the first value ORed with the second
pick => Returns the series value at a given index
poke => Replaces the series value at a given index, and returns
the new value
power => Returns a number raised to a given power (exponent)
put => Replaces the value following a key, and returns the new value
random => Returns a random value of the same datatype; or shuffles series
read => Read from a file, URL, or other port
reflect => Returns internal details about a value via reflection
remainder => Returns what is left over when one value is divided by another
remove => Returns the series at the same index after removing a value
reverse => Reverses the order of elements; returns at same position
round => Returns the nearest integer. Halves round up (away from zero)
by default
select => Find a value in a series and return the next value, or NONE
skip => Returns the series relative to the current index
sort => Sorts a series (modified); default sort order is ascending
subtract => Returns the difference between two values
swap => Swaps elements between two series or the same series
tail => Returns a series at the index after its last value
tail? => Returns true if a series is past its last value
take => Removes and returns one or more elements
to => Converts to a specified datatype
trim => Removes space from a string or NONE from a block or object
write => Writes to a file, URL, or other port
xor~ => Returns the first value exclusive ORed with the second

; -------------------------------------------------------------------------
; Check if a word is an action!
; -------------------------------------------------------------------------
red>> action? :take ; Colon is mandatory to get to function definition
== true
top alphanumeric-index category-index

Red word:    action?    type=function!

Categories to which this word belongs: Type Checking

Description
The word action? returns true if its argument is an action!
type, or false otherwise.
Examples
red>> action? :take     ; Colon is mandatory to get to function definition
== true
top alphanumeric-index category-index

Red word:    add    type=action!

Categories to which this word belongs: Math

Description
The word add adds 2 values together.
This is equivalent to the infix operator +.

Has 2 operands, which can be expressions or values
Examples
; -------------------------------------------------------------------------
; Add some number!s
; -------------------------------------------------------------------------

add -1 3
== 2

add 4 / 2 5
== 7
; 4 / 2 == 2
; 2 + 5 == 7
; Returns 7

add 2.3 7.77 - 2
== 8.07
; 7.77 - 2 == 5,77
; 2.3 + 5.77 == 8.07
; Returns 8.07

; -------------------------------------------------------------------------
; Add a number! to a pair! and vv
; -------------------------------------------------------------------------

red>> add 2x4 5
== 7x9

red>> add 5 2x4
== 7x9

top alphanumeric-index category-index

Red word:    all    type=native!

Categories to which this word belongs: Boolean, Comparison, Logic

Description
The word all evaluates each expression in a block in turn 
and either returns the last resulting value (if that value is
not falsey) or returns none if it encounters a falsey
resulting value.

Has 1 parameter, a block.

The resulting value of all can be used in the if or either words, where all
functions like a short-circuit and.
Examples
all [1 + 1 2 + 2 3 = 3 2 + 6]
== 8
; 1 + 1 == 2 (not falsey, so evaluation continues)
; 2 + 2 == 4 (not falsey, so evaluation continues)
; 3 = 3 == true (not falsey, so evaluation continues)
; 2 + 6 == 8
; Returns the last resulting value (8) because no falsey values detected

all [1 + 1 3 = 4 2 + 2 "John"]
== none
; 1 + 1 == 2 (which is not falsey, so evaluation continues)
; 3 = 4 == false
; Returns none immediately, because a falsey value (false) is detected
top alphanumeric-index category-index

Red word:    also    type=function!

Categories to which this word belongs: Evaluation, Special Purpose

Description
The word also first evaluates its first argument and then
also evaluates its second argument.
Examples
red>> a: 4
== 4

red>> b: 5
== 5

red>> also c: a + b c: c * a
== 9 ; Returns result of first expression

red>> c
== 36 ; Contains result of last expression
top alphanumeric-index category-index

Red word:    alter    type=function!

Categories to which this word belongs: Series, String manipulation

Description
The word alter appends/removes a value to/from a series!.
The value can be of any type.

If the value does NOT exist in the series! it is appended, and true is returned.
The original series! is modified.

If the value does exist, it is removed, and false is returned.

Note that find can be used to search a value in a series!.

There are no refinements.
Examples
red>> a: ["cat" "dog"]
== ["cat" "dog"]

red>> alter a "fish"
== true

red>> a
== ["cat" "dog" "fish"]

red>> alter a "fish"
== false

red>> a
== ["cat" "dog"]

red>> find a "dog"
== ["dog"]

red>> find a "fish"
== none
top alphanumeric-index category-index

Red word:    and    type=op!

Categories to which this word belongs: Bit manipulation, Boolean, Comparison, Logic

Description
The infix word and performs a logical "and" of two values.
The values are restricted to these types:
logic! integer! char! bitset! typeset! pair! tuple! vector!

It is the infix version of the and~ word.

In the case of anding two integer!s (or types closely related to integer!s,
such as char!, pair!), a bitwise (bit-by-bit) process is performed.

In general, types can be mixed, but logic! types cannot be mixed with other types.

The type of the result is the same type as the first value for a bitwise and.
For a logic and true or false are returned.

There are no refinements.
Examples
; -------------------------------------------------------------------------
; And some number!s
; -------------------------------------------------------------------------

red>> (3 > 2) and true
== true

red>> 8 and 16
== 0
red>> 16 and false
*** Script error: logic type is not allowed here
*** Where: and

; -------------------------------------------------------------------------
; And pair!s
; -------------------------------------------------------------------------

red>> my-pair: 3x4
== 3x4

red>> my-pair and 1
== 1x0

red>> 1 and my-pair
*** Script error: and does not allow pair for its value2 argument
*** Where: and

; -------------------------------------------------------------------------
; And vector!s
; -------------------------------------------------------------------------

red>> v1: make vector! [1 2 3]
== make vector! [1 2 3]

red>> v2: make vector! [1 1 1]
== make vector! [1 1 1]

red>> v1 and v2
== make vector! [1 0 1]
top alphanumeric-index category-index

Red word:    and~    type=action!

Categories to which this word belongs: Bit manipulation, Boolean, Comparison, Logic

Description
The and~ word performs a logical "and" of its 2 arguments.
The arguments are restricted to these types:
logic! integer! char! bitset! typeset! pair! tuple! vector!

It is the functional version of the infix and word.

In the case of and~ing two integer!s (or types closely related to integer!s,
such as char!, pair!), a bitwise (bit-by-bit) process is performed.

In general, types can be mixed, but logic! types cannot be mixed with other types.

The type of the result is the same type as the first value for a bitwise and~.
For a logic and~ true or false are returned.

There are no refinements.
Examples
; -------------------------------------------------------------------------
; Using number!s
; -------------------------------------------------------------------------

red>> and~ (3 > 2 ) true
== true

red>> and~ 8 16
== 0

; -------------------------------------------------------------------------
; Using bad parameter
; -------------------------------------------------------------------------

red>> and~ 16 false
*** Script error: logic type is not allowed here
*** Where: and~

; -------------------------------------------------------------------------
; Using pair!
; -------------------------------------------------------------------------

red>> my-pair: 3x4
== 3x4

red>> and~ my-pair 1
== 1x0

red>> and~ 1 my-pair
*** Script error: and~ does not allow pair for its value2 argument
*** Where: and~

; -------------------------------------------------------------------------
; Using vector!
; -------------------------------------------------------------------------

red>> v1: make vector![1 2 3]
== make vector! [1 2 3]

red>> v2: make vector![1 1 1]
== make vector! [1 1 1]

red>> and~ v1 v2
== make vector! [1 0 1]
top alphanumeric-index category-index

Red word:    any    type=native!

Categories to which this word belongs: Boolean, Comparison, Logic

Description
The word any evaluates each expression in a block! in turn and returns
the first resulting value that is not falsey.

If all resulting values are falsey it returns none.

Has 1 parameter, a block!

The resulting value of any can be used in the if or either words,
where any functions like a short-circuit or.
Examples
any [none false 1 false]
== 1
; none -> none (is falsey, so evaluation continues)
; false -> false (is falsey, so evaluation continues)
; 1 == 1
; Returns 1 immediately because a non falsey value (1) is detected

any [2 = 3 4 = 5 2 + 2 = 4 5 - 3 = 1]
== true
; 2 = 3 == false (is falsey, so evaluation continues)
; 4 = 5 == false (is falsey, so evaluation continues)
; 2 + 2 = 4 == true
; Returns true immediately because a non falsey value (true) is detected
top alphanumeric-index category-index

Red word:    any-block?    type=function!

Categories to which this word belongs: Type Checking

Description
The word any-block? returns true if its argument is of type block!.
Examples
red>> any-block? "w"
== false

red>> any-block? []
== true

red>> any-block? {}
== false

red>> any-block? [x [y z] 1 2]
== true
top alphanumeric-index category-index

Red word:    any-function?    type=function!

Categories to which this word belongs: Type Checking

Description
The word any-function? returns true if its argument is a function!.

It has no refinements.
Examples
red>> any-function? a
== false

red>> any-function? :find
== true
; The colon (:) gets the definition, not the value of a function
top alphanumeric-index category-index

Red word:    any-list?    type=function!

Categories to which this word belongs: Type Checking

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    any-object?    type=function!

Categories to which this word belongs: Type Checking

Description
The word any-object? returns true if its argument is an object!.

It has no refinements.
Examples
red>> my-obj: make object! [ x: 10 y: 10 ]
== make object! [
x: 10
y: 10
]

red>> any-object? my-obj
== true

red>> a: 22

red>> any-object? a
== false
top alphanumeric-index category-index

Red word:    any-path?    type=function!

Categories to which this word belongs: Type Checking

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    any-string?    type=function!

Categories to which this word belongs: Type Checking

Description
The word any-string? returns true if its argument is any type of string!,
including the types string!, file! and url!.

It has no refinements.
Examples
red>> any-string? http://www.aaa.com
== true

red>> any-string? "fred"
== true

red>> any-string? 123
== false

red>> any-string? %notes/data.txt
== true
top alphanumeric-index category-index

Red word:    any-word?    type=function!

Categories to which this word belongs: Type Checking

Description
The word any-word? returns true if its argument is a word!.

It has no refinements.
Examples
red>> any-word? 123
== false
; 123 is a number, not a symbol

red>> any-word? find
*** Script error: find is missing its series argument
*** Where: find
; Red tries to invoke the function find but fails on missing arguments

red>> any-word? 'find
== true
; Red takes quoted symbols literally

red>> any-word? :find
== false
; A function definition is not a word

red>> a: 'find
== find

red>> any-word? a
== true
top alphanumeric-index category-index

Red word:    append    type=action!

Categories to which this word belongs: Series, String manipulation

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    arccosine    type=native!

Categories to which this word belongs: Math

Description
The word arccosine returns the trigonometric arccosine (in degrees by default).

Has 1 parameter, a number!.

Refinements:
/radians : returns the angle in radians;
without refinement returns the angle in degrees.

The resulting numeric angle value of arccosine can be used in an expression.
Examples
arccosine 0.5
== 60.0

arccosine/radians 1
== 0.0
top alphanumeric-index category-index

Red word:    arcsine    type=native!

Categories to which this word belongs: Math

Description
The word arcsine returns the trigonometric arcsine (in degrees by default).

Has 1 parameter, a number!.

Refinements:
/radians : returns the angle in radians;
without refinement returns the angle in degrees.
Examples
arcsine 0.5
== 30.0

arcsine/radians 0
== 0.0
top alphanumeric-index category-index

Red word:    arctangent    type=native!

Categories to which this word belongs: Math

Description
The word arctangent returns the trigonometric arctangent (in degrees by default).

Has 1 parameter, a number!.

Refinements:
/radians : returns the angle in radians;
without refinement returns the angle in degrees.
Examples
arctangent 0
== 0.0

arctangent/radians 0
== 0.0
top alphanumeric-index category-index

Red word:    arctangent2    type=native!

Categories to which this word belongs: Math

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    as-color    type=routine!

Categories to which this word belongs: Casting Types, Conversion, Colors

Description
The word as-color generates a tuple! with R, G and B values
from its 3 integer! arguments.
Examples
red>> as-color 255 0 0
== 255.0.0

; -------------------------------------------------------------------------
; Predefined colors (e.g. red green etc.) are available also
; -------------------------------------------------------------------------
red>> red
== 255.0.0

red>> green
== 0.255.0

red>> yellow
== 255.255.0
top alphanumeric-index category-index

Red word:    as-ipv4    type=routine!

Categories to which this word belongs: Casting Types, Conversion

Description
The word as-ipv4 returns an IP version 4 address created from
its 4 integer! arguments.

If an argument is not within the range 0 .. 255, Red tries to
"guess" an appropriate value using the modulo of its (absolute) value.
Examples
red>> as-ipv4 1 3 12 253
== 1.3.12.253

red>> as-ipv4 1 3 12 0
== 1.3.12.0

red>> as-ipv4 1 3 12 255
== 1.3.12.255

red>> as-ipv4 1 3 12 256
== 1.3.12.0

red>> as-ipv4 1 3 12 257
== 1.3.12.1

red>> as-ipv4 1 3 12 258
== 1.3.12.2

red>> as-ipv4 0 3 12 255
== 0.3.12.255

red>> as-ipv4 -1 3 12 255
== 255.255.255.255

red>> as-ipv4 -2 3 12 255
== 254.255.255.255

red>> as-ipv4 -3 3 12 255
== 253.255.255.255
top alphanumeric-index category-index

Red word:    as-pair    type=native!

Categories to which this word belongs: Casting Types, Conversion

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    as-rgba    type=routine!

Categories to which this word belongs: Casting Types, Conversion

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    asin    type=routine!

This word is a synonym for arcsine
top alphanumeric-index category-index

Red word:    ask    type=routine!

Categories to which this word belongs: Input

Description
Displays a prompt and gets the value that the user types at STDIN.

Has 1 parameter, a string!

The resulting string value of ask can be used in an expression
Examples
answer: ask "What is your name?"
What is your name?Carl
== "Carl"

answer
== "Carl"
top alphanumeric-index category-index

Red word:    at    type=action!

Categories to which this word belongs: Series, String manipulation

Description
The at word returns a series! at a given integer index.

Note that it does not extract one item. Rather, it returns a reference (pointer)
into the original series!.

The original series! is unchanged.

Note that series! (which includes string!s) are indexed from 1.

If the index is off the 'left-hand side' of the series!, the whole series!
is returned.

If the series! is beyond the right-hand side, an empty series! is returned.

There are no refinements.
Examples
red>> at [1 2 3 4 5] 3
== [3 4 5]

red>> at "abcde" 3
== "cde"

red>> at "abcd" 6
== ""

red>> at [1 2 3 4] -2
== [1 2 3 4]

red>> at [1 2 3 4] 0
== [1 2 3 4]
top alphanumeric-index category-index

Red word:    atan    type=routine!

This word is a synonym for arctangent
top alphanumeric-index category-index

Red word:    atan2    type=native!

This word is a synonym for arctangent2
top alphanumeric-index category-index

Red word:    attempt    type=function!

Categories to which this word belongs: Error

Description
The word attempt tries to evaluate a block! 
and returns the result or none if an error occurs.
Examples
red>> s: "abcd"
== "abcd"
red>> calc: 3 * s
*** Script error: * does not allow string for its value2 argument
*** Where: *

red>> calc: attempt [3 * s]
== none
red>> calc
== none

red>> calc: attempt [3 * 2.2]
== 6.6
red>> calc
== 6.6
top alphanumeric-index category-index

Red word:    back    type=action!

Categories to which this word belongs: Series, String manipulation

Description
The word back moves the index of a series! 1 position towards
the head (= the start) of the series!.

When a series! index is already at head position, back won't
change the index; it stays at head.

The opposite of back is next.
Examples
red>> ser: [1 2 3]
== [1 2 3]

red>> head? ser
== true

red>> index? ser
== 1

red>> back ser
== [1 2 3]

red>> ser: back ser
== [1 2 3]

red>> head? ser
== true

red>> index? ser
== 1

red>> ser: tail ser
== []

red>> index? ser
== 4

red>> ser: back ser
== [3]

red>> index? ser
== 3

red>> ser: back ser
== [2 3]

red>> index? ser
== 2

red>> ser: back ser
== [1 2 3]

red>> index? ser
== 1

red>> head? ser
== true
top alphanumeric-index category-index

Red word:    binary!    type=datatype!

Categories to which this word belongs: Datatypes

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    binary?    type=function!

Categories to which this word belongs: Type Checking

Description
The word binary? returns true if its argument is of binary! type.
A literal binary series! is surrounded by #{...}
Examples
red>> binary? #{22}
== true

red>> binary? #{ 22 FF AA }
== true

red>> binary? 16
== false
top alphanumeric-index category-index

Red word:    bind    type=native!

Categories to which this word belongs: Objects

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    bitset!    type=datatype!

Categories to which this word belongs: Datatypes

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    bitset?    type=function!

Categories to which this word belongs: Type Checking

Description
The word bitset? returns true if its argument is a bitset! type.
Examples
red>> b: make bitset! [1 3 5]
== make bitset! #{54}

red>> n: [2 3 6]
== [2 3 6]

red>> bitset? b
== true

red>> bitset? n
== false
top alphanumeric-index category-index

Red word:    block!    type=datatype!

Categories to which this word belongs: Datatypes

Description
The datatype! block! represents a series! type.

They are enclosed in square brackets [ ] and can run over many lines.

The adagium code = data fits very well for a block!.
A block! is just a block of data, but blocks can also be used
as part of the code.
Examples
; -------------------------------------------------------------------------
; Create a block! with a string!, an integer! and a float! in it.
; -------------------------------------------------------------------------
red>> ["Mike" 55 1.95]
== ["Mike" 55 1.95]

; -------------------------------------------------------------------------
; Use a block! in program code.
; -------------------------------------------------------------------------
red>> if 3 > 2 [print "bigger"]
== bigger

; -------------------------------------------------------------------------
; Code = data
; -------------------------------------------------------------------------
red>> a: 22
== 22

red>> my-block: [4 + a]
== [4 + a] ; Just a data block!

red>> do my-block
== 26 ; Happens to contain valid code!

; -------------------------------------------------------------------------
; Beware of unset! values in a block!
; -------------------------------------------------------------------------
red>> my-data: [name "Li" age 42]
== [name "Li" age 42]

red>> print my-data
*** Script Error: name has no value
*** Where: print
top alphanumeric-index category-index

Red word:    block?    type=function!

Categories to which this word belongs: Type Checking

Description
The word block? returns true if its parameter is a 
valid block! or false otherwise.

Has 1 parameter.
Examples
block? "test"
== false

block? [test 1 2 3]
== true
top alphanumeric-index category-index

Red word:    body-of    type=function!

Categories to which this word belongs: Functions

Description
The word body-of shows the body of a function! type.

This word is tightly related with the source word.
Examples
red>> x: function [a b] [ a + b ]
== func [a b][a + b]

red>> source x
x: func [a b][a + b]

red>> body-of :x
== [a + b]

red>> source list-dir
list-dir: func [
{Displays a list of files and directories from given folder or current one}
dir [any-type!] "Folder to list"
/col "Forces the display in a given number of columns"
n [integer!] "Number of columns"
/local list max-sz name
][
unless value? 'dir [dir: %.]
unless find [file! word! path!] type?/word :dir [
cause-error 'script 'expect-arg ['list-dir type? :dir 'dir]
]
list: read normalize-dir dir
max-sz: either n [system/console/limit / n - n] [
n: max 1 system/console/limit / 22
22 - n
]
while [not tail? list] [
loop n [
if max-sz <= length? name: list/1 [
name: append copy/part name max-sz - 4 "..."
]
prin tab
prin pad form name max-sz
prin " "
if tail? list: next list [exit]
]
prin lf
]
]

red>> print mold body-of :list-dir
[
unless value? 'dir [dir: %.]
unless find [file! word! path!] type?/word :dir [
cause-error 'script 'expect-arg ['list-dir type? :dir 'dir]
]
list: read normalize-dir dir
max-sz: either n [system/console/limit / n - n] [
n: max 1 system/console/limit / 22
22 - n
]
while [not tail? list] [
loop n [
if max-sz <= length? name: list/1 [
name: append copy/part name max-sz - 4 "..."
]
prin tab
prin pad form name max-sz
prin " "
if tail? list: next list [exit]
]
prin lf
]
]
top alphanumeric-index category-index

Red word:    break    type=native!

Categories to which this word belongs: Iteration

Description
The word break breaks out of a loop.

Refinements:
/return : forces the loop function to return the value following.
Examples
; -------------------------------------------------------------------------
; Normal example
; -------------------------------------------------------------------------

foreach number [1 2 4 8 16] [
if number > 8 [break]
print number
]
print "loop 1 teminated"
1
2
4
8
loop 1 teminated

; -------------------------------------------------------------------------
; Contreived example
; -------------------------------------------------------------------------

print foreach number [1 2 4 8 16] [
if number > 8 [break/return -999]
print number
]
print "loop 2 teminated"
1
2
4
8
-999
loop 2 teminated
; The foreach loop returns the value -999,
; which in turn is printed by "print"
top alphanumeric-index category-index

Red word:    browse    type=routine!

Categories to which this word belongs: Unknown

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    case    type=native!

Categories to which this word belongs: Conditional branching

Description
The word case provides a multi-way branch structure.  
The block! following the first true condition is evaluated.

The result of a case is the value of the last expression evaluated.

Conditional expressions are supported, rather than the simpler form
in the switch word.

Refinement:
/all : causes the blocks for every true condition to be evaluated.
Examples
; -------------------------------------------------------------------------
; case without /all refinement
; -------------------------------------------------------------------------

n: 555
case [
n < 10 [print "small"]
n < 100 [print "medium"]
n < 1000 [print "large"]
true [print "none of these"]
]
large

; -------------------------------------------------------------------------
; case with /all refinement (1)
; -------------------------------------------------------------------------

n: 555
case/all [
n < 10 [print "small"]
n < 100 [print "medium"]
n < 1000 [print "large"]
true [print "none of these"]
]
large
none of these

; -------------------------------------------------------------------------
; case with /all refinement (2)
; -------------------------------------------------------------------------

n: 555
case/all [
n > 10 [print "small"]
n > 100 [print "medium"]
n > 1000 [print "large"]
true [print "none of these"]
]
small
medium
none of these
top alphanumeric-index category-index

Red word:    catch    type=native!

Categories to which this word belongs: Error

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    cause-error    type=function!

Categories to which this word belongs: Error

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    cd    type=function!

This word is a synonym for change-dir
top alphanumeric-index category-index

Red word:    change    type=action!

Categories to which this word belongs: Series, String manipulation

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    change-dir    type=function!

Categories to which this word belongs: Directories, Files

Description
The word change-dir changes the current directory.

The argument can be one of file! word! path!.

The directory to change to can be:
- an absolute path
- a relative path!
Examples
; -------------------------------------------------------------------------
; Using an absolute path
; -------------------------------------------------------------------------
red>> change-dir %/e/src
== %/e/src/

red>> dir
8th/ go/ python/ red/ spiderbasic/

; -------------------------------------------------------------------------
; Using a relative path
; -------------------------------------------------------------------------
red>> change-dir %go
== %/e/src/go/

red>> dir
bin32/ bin64/ pkg/ src/
top alphanumeric-index category-index

Red word:    char!    type=datatype!

Categories to which this word belongs: Datatypes

Description
The datatype! char! represents a scalar! type containing 
a single char!.

A literal looks like:
#"A"
Only a single character is valid. So e.g. #"AZ" is invalid!

A series! of char! is a string!.

Representation of the letter A as a:
char! -> #"A"
string! -> "A"

The caret ^ is the escape character for special ASCII codes:
- a numeric value is interpreted as HEX
- null, line, tab, page, esc, back, delete
To use such a code, specify:
#"^(code)"
Examples
; -------------------------------------------------------------------------
; Some examples
; -------------------------------------------------------------------------
red>> #"A"
== #"A"

red>> print #"A"
A

red>> print #"^(41)" ; Hex 41 is decimal 65 is ASCII A
A

red>> first "dog" ; A char! as element of a string! series!
== #"d"

red>> print #"^(line)" ; Output a blank line


red>> prin 3 prin #"^(tab)" print 6
3 6

red>> #"A" + 1
== #"B"

red>> #"B" > #"A"
== true
top alphanumeric-index category-index

Red word:    char?    type=function!

Categories to which this word belongs: Type Checking

Description
The char? word returns true if the value is a char! type. 
Examples
red>> char? 33
== false
; 33 is a number and thus not a char!

red>> char? #"A"
== true

red>> char? "AB"
== false
; "AB" is a string, which is a series type
top alphanumeric-index category-index

Red word:    charset    type=function!

Categories to which this word belongs: Sets

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    checksum    type=native!

Categories to which this word belongs: Network

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    clean-path    type=function!

Categories to which this word belongs: Directories, Files

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    clear    type=action!

Categories to which this word belongs: Series, String manipulation

Description
The word clear deletes the contents of a series starting from the current
index.
Examples
; -------------------------------------------------------------------------
; Clear a string!
; -------------------------------------------------------------------------
red>> s: "abcdefghijklm"
== "abcdefghijklm"

red>> clear s
== ""

red>> s
== ""

; -------------------------------------------------------------------------
; Clear part of a series!
; -------------------------------------------------------------------------
red>> n: [1 2 3 4 5 6 7]
== [1 2 3 4 5 6 7]

red>> clear skip n 3
== []

red>> n
== [1 2 3]

; -------------------------------------------------------------------------
; Clear from a found position
; -------------------------------------------------------------------------
red>> s: "the quick brown fox jumps over the lazy dog"
== "the quick brown fox jumps over the lazy dog"

red>> clear find s "jumps"
== ""

red>> s
== "the quick brown fox "
top alphanumeric-index category-index

Red word:    clear-reactions    type=function!

Categories to which this word belongs: Unknown

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    collect    type=function!

Categories to which this word belongs: Series, String manipulation

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    comment    type=function!

Categories to which this word belongs: Documentation

Description
The word comment introduces a comment in a Red program.

It has the form:
comment {
... multi-line comment ...
}
or:
comment " ... single-line comment ... "
Examples
comment { 
This is a multi-line comment,
consisting of more than one line.
}

comment "And this is a single-line comment!"

top alphanumeric-index category-index

Red word:    complement    type=action!

Categories to which this word belongs: Bit manipulation

Description
The word complement returns the complement of the argument.

Has one argument, of type:
logic! integer! bitset! typeset!

For logic!, it returns true or false.

For values with an accessible bit representation, it returns the
"ones complement".
Examples
; -------------------------------------------------------------------------
; With logic!
; -------------------------------------------------------------------------

red>> complement 3 > 2
== false

; -------------------------------------------------------------------------
; With integer!s
; -------------------------------------------------------------------------

red>> complement 2
== -3

red>> complement -1
== 0

red>> complement 63
== -64

; -------------------------------------------------------------------------
; With bitset!
; -------------------------------------------------------------------------

red>> b: make bitset![0 1]
== make bitset! #{C0}

red>> complement b
== make bitset! [not #{C0}]
top alphanumeric-index category-index

Red word:    complement?    type=native!

Categories to which this word belongs: Type Checking

Description
The word complement? returns true if the bitset is 
complemented (that is: inverted with not).
Examples
red>> vowels: charset ["AEIOU"]
== make bitset! #{0000000000000000444104}

red>> complement? vowels
== false

red>> non-digits: charset [ not "0123456789"]
== make bitset! [not #{000000000000FFC0}]

red>> complement? non-digits
== true
top alphanumeric-index category-index

Red word:    compose    type=native!

Categories to which this word belongs: Series, String manipulation

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    construct    type=native!

Categories to which this word belongs: Objects

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    context    type=function!

Categories to which this word belongs: Objects

Description
The word context is a shorter form of make object!.

Using context it is very easy to "hide" variables and functions from
the global naming scope.
Examples
; -------------------------------------------------------------------------
; Show that both forms are equal
; -------------------------------------------------------------------------
red>> x: context [a: 1 b: 2]
== make object! [
a: 1
b: 2
]

red>> y: make object! [a: 1 b: 2]
== make object! [
a: 1
b: 2
]

red>> x = y
== true

; -------------------------------------------------------------------------
; Reference fields in a context
; -------------------------------------------------------------------------
red>> x/a
== 1

red>> x/b
== 2

red>> y/a
== 1

red>> y/b
== 2

; -------------------------------------------------------------------------
; Use a function in a context
; -------------------------------------------------------------------------
red>> p: context [x: 5 y: 6 f: function [] [x + y]]
== make object! [
x: 5
y: 6
f: func [][x + y]
]

red>> p/f ; Uses the x and y in the scope of the context
== 11

red>> p/x: 20 ; Update a field
== 20

red>> p/f
== 26
top alphanumeric-index category-index

Red word:    context?    type=native!

Categories to which this word belongs: Type Checking

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    continue    type=native!

Categories to which this word belongs: Iteration

Description
The word continue transfers control back to the begin of a loop.
Examples
repeat n 5 [
print ["Before" n]
if n < 3 [continue]
print ["After" n]
]
Before 1
Before 2
Before 3
After 3
Before 4
After 4
Before 5
After 5
top alphanumeric-index category-index

Red word:    copy    type=action!

Categories to which this word belongs: Series, String manipulation

Description
The word copy returns a copy of a series! or bitset!.

The word copy does not work on single items such as:
integer! float! char! etc.
For these, we can simply use the colon (get word).

It has one argument of an appropriate type.

For (potentially large) series!, Red works with references
(pointers to series!) rather than directly with the contents.

Refinements
/part - limit the length of the result,
where length is a number! or series!
/deep - copy nested values also
/types - copy only specific types of non-scalar values.
Examples
red>> b: [1 2 3 4]
== [1 2 3 4]
; Create variable b which points to a new block

red>> b2: b
== [1 2 3 4]
; Assign variable b2 to point to the same block that b points to.

red>> b/2: -999
== -999
; Modify the block that b points to at position 2.

red>> b
== [1 -999 3 4]
; As expected b now points to the changed block

red>> b2
== [1 -999 3 4]
; Because b2 points to the same block you see the same change there also!

red>> b: [1 2 3 4]
== [1 2 3 4]
; Create variable b which points to a new block.

red>> b2: copy b
== [1 2 3 4]
; Create variable b2 which points to a copy of the block b points to.

red>> b/2: -999
== -999
; Show that the block that b points to has changed

red>> b2
== [1 2 3 4]
; Because of the copy the block b2 points to is not modified this time.

red>> s: "a string"
== "a string"
; Create variable s pointing to a string.

red>> s2: copy s
== "a string"
; Create variable s2 pointing to a copy of the string that s points to.

red>> a: [22 33 "name" [44 1.34]]
== [22 33 "name" [44 1.34]]
; Create variable a that points to a new block.

red>> b: copy a
== [22 33 "name" [44 1.34]]
; Create variable b and point it to a new copy to the block that a points to.

red>> b: copy/part a 2
== [22 33]
; Only the first 2 items of a are copied!
top alphanumeric-index category-index

Red word:    cos    type=routine!

This word is a synonym for cosine
top alphanumeric-index category-index

Red word:    cosine    type=native!

Categories to which this word belongs: Math

Description
The word cosine returns the trigonometric cosine.

Has 1 parameter, a number! (representing an angle).

Refinements:
/radians : expects the input angle in radians;
without refinement expects the input angle in degrees.
Examples
cosine 90
== 0.0

cosine/radians pi
== -1.0
top alphanumeric-index category-index

Red word:    create-dir    type=routine!

Categories to which this word belongs: Unknown

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    datatype!    type=datatype!

Categories to which this word belongs: Datatypes

Description
The word datatype! is the "mother" of all Red's datatypes.

Note that a typeset! can be defined for grouping several datatypes!

Note that datatype! and typeset! are also a datatype!!
Examples
red>> ? datatype!
action! binary! bitset! block! char!
datatype! error! event! file! float!
function! get-path! get-word! hash! image!
integer! issue! lit-path! lit-word! logic!
map! native! none! object! op!
pair! paren! path! percent! point!
refinement! routine! set-path! set-word! string!
time! tuple! typeset! unset! url!
vector! word!
top alphanumeric-index category-index

Red word:    datatype?    type=function!

Categories to which this word belongs: Type Checking

Description
The word datatype? returns true if its argument is a 
datatype! (e.g. integer!, char! etc).
Examples
Examples

red>> datatype? 123
== false

red>> datatype? integer!
== true

red>> datatype? block!
== true
top alphanumeric-index category-index

Red word:    debase    type=native!

Categories to which this word belongs: Bases of Numbers

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    default-input-completer    type=function!

Categories to which this word belongs: Unknown

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    dehex    type=native!

Categories to which this word belongs: Conversion, Formatting

Description
The word dehex converts URL-style hex encoded (%xx) strings 
into characters. The argument can be a string! or a file!.
Examples
red>> dehex "%41BC"                     
== "ABC"
; 41 is hex for B

red>> dehex "www.search.com/for%20this"
== "www.search.com/for this"
; Hex 20 is space

red>> dehex %my%20file.txt
== "my file.txt"
; file! type
top alphanumeric-index category-index

Red word:    difference    type=native!

Categories to which this word belongs: Sets

Description
The word difference returns the elements of two series 
that are not present in both.

Both series arguments must be of the same datatype, which
can be:
block! hash! string! bitset! typeset!.

difference in one of several set-style functions.

Refinements:
/case - use case-sensitive comparison.
/skip - treat the series! as fixed size records.
Specify the size as an integer!.
Examples
red>> difference [1 2 99 4] [1 2 3 4]
== [99 3]

red>> difference ["cat" "dog"] ["dog" "mouse" "fish"]
== ["cat" "mouse" "fish"]

red>> difference "abcd" "Ab"
== "cd"

red>> difference/case "abcd" "Ab"
== "acdA"
top alphanumeric-index category-index

Red word:    dir    type=function!

Categories to which this word belongs: Directories, Files

Description
The word dir lists the contents of a directory.

It is tightly related to the word list-dir.

The directory to list to can be:
- an absolute path
- a relative path!

If no argument given, it lists the current directory.
Examples
; -------------------------------------------------------------------------
; Using an absolute path
; -------------------------------------------------------------------------
red>> dir %/e/src
8th/ go/ python/ red/
spiderbasic/

; -------------------------------------------------------------------------
; Using it without an argument lists the current directory
; -------------------------------------------------------------------------
red>> dir
basehtml.txt colors.txt design/ gensite.red
gensite.txt pages/ publish/ redftp.lnk
rexec.red tst.red words/
top alphanumeric-index category-index

Red word:    dir?    type=function!

Categories to which this word belongs: Directories, Files, Type Checking

Description
The word dir? returns true if the supplied name is a valid file path!, 
otherwise returns false.

A valid file path! must have a trailing /.

NOTE dir? does not look in the file system at all. It only tells you if the
path! is a valid directory path! with a trailing slash!

Has 1 parameter, which must be a valid file path!.
Examples
; Non-existent directory
; Returns false because trailing / is missing
dir? %/c/rubbish
== false
; Returns true because trailing / is present
dir? %/c/rubbish/
== true

; Existing directory
; Returns false because trailing / is missing
dir? %/c/windows
== false
; Returns true because trailing / is present
dir? %/c/windows/
== true
top alphanumeric-index category-index

Red word:    dirize    type=function!

Categories to which this word belongs: Conversion, Directories, Files

Description
The word dirize turns its argument into a valid directory.

The argument can be of file! string! url!.

Effectively dirize only appends a trailing / if needed.
Examples
red>> dirize "/e/src"
== "/e/src/" ; Note trailing / appended

red>> dirize %/e/src
== %/e/src/ ; Note trailing / appended

red>> dirize %/e/src/
== %/e/src/ ; Nothing happened - directory was already valid

red>> dirize %.
== %./ ; Note trailing / appended
top alphanumeric-index category-index

Red word:    divide    type=action!

Categories to which this word belongs: Math

Description
The word divide returns the first value divided by the second.
This is equivalent to the infix operator /.

Has 2 arguments, which must be of the type:
number! char! pair! tuple! vector!

When a combination of integer! and float! values are divided, the result
is a float!.

When integer!s are divided, the result is an integer!, truncated toward zero.

Division by zero produces a run-time error.
Examples
red>> divide 8 3.0
== 2.666666666666667

red>> divide 8 3
== 2

red>> divide -8 3
== -2

red>> divide 4.5.6 2
== 2.2.3

red>> v: make vector![4 2 8]
== make vector! [4 2 8]

red>> divide v make vector![1 2 3 4]
== make vector! [4 1 2]

red>> v2: make vector![ 2 2 3]
== make vector! [2 2 3]

red>> divide v v2
== make vector! [2 1 2]
top alphanumeric-index category-index

Red word:    do    type=native!

Categories to which this word belongs: Evaluation

Description
The word do evaluates the code in its argument.

Single argument:
1. can be a script to execute;
in that case the /args refinement can be used to specify arguments
for that script (a string! or a block!)
2. can be a string! or a block! containing Red code to be
evaluated

Refinements:
/args - arguments for script to be invoked
Examples
; -------------------------------------------------------------------------
; Evaluate a script
; -------------------------------------------------------------------------

; Given a separate script %tst.red:

; Red []
; print "Hi there from %tst.red!"
; args: system/script/args
; print ["My arguments are:" system/script/args]
; if not none? system/script/args [
; foreach arg system/script/args [
; print ["Arg:" arg]
; ]
; ]

; You can evaluate the script without arguments like so:
red>> do %tst.red
Hi there from %tst.red!
My arguments are: none
== none

; You can evaluate the script with string! argument like so:
red>> do/args %tst.red "my args"
Hi there from %tst.red!
My arguments are: my args
Arg: m
Arg: y
Arg:
Arg: a
Arg: r
Arg: g
Arg: s

; If you need multiple arguments, use a block!
red>> do/args %tst.red ["my" "individual" "args"]
Hi there from %tst.red!
My arguments are: my individual args
Arg: my
Arg: individual
Arg: args

; -------------------------------------------------------------------------
; Evaluate a block
; -------------------------------------------------------------------------

red>> blk: [x: 10 y: 20 z: x + y print z]
== [x: 10 y: 20 z: x + y print z]
red>> do blk
30
red>> x
== 10
red>> y
== 20
red>> z
== 30

; -------------------------------------------------------------------------
; Evaluate a string
; -------------------------------------------------------------------------

; Here we show how to do complex things using do

; Use variables to contain the name and value for a variable
; to be embedded in the object
red>> var: "vname"
== "vname"
red>> val: 11
== 11

; Prepare the string with the code
red>> str: copy {obj: make object! [}
== "obj: make object! ["
red>> append str var
== "obj: make object! [vname"
red>> append str copy {: }
== "obj: make object! [vname: "
red>> append str val
== "obj: make object! [vname: 11"
red>> append str copy {]}
== "obj: make object! [vname: 11]"

; String is now complete
red>> str
== "obj: make object! [vname: 11]"

; Evaluate the string
red>> do str
== make object! [
vname: 11
]

; Show that the object now exists:
red>> obj
== make object! [
vname: 11
]
red>> obj/vname
== 11
top alphanumeric-index category-index

Red word:    do-actor    type=function!

Categories to which this word belongs: GUI (VID)

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    do-events    type=function!

Categories to which this word belongs: GUI (VID)

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    do-file    type=function!

Categories to which this word belongs: Unknown

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    do-safe    type=function!

Categories to which this word belongs: Evaluation

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    does    type=native!

Categories to which this word belongs: Functions

Description
The word does defines a function with no arguments or 
local variables.
Examples
welcome: does [
print "Welcome"
print "to Red"
]

welcome
Welcome
to Red
top alphanumeric-index category-index

Red word:    dump-reactions    type=function!

Categories to which this word belongs: Unknown

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    either    type=native!

Categories to which this word belongs: Conditional branching

Description
The word either evaluates a conditional expression. 
If the result thereof is true the first block! will be evaluated.
If false the second block! will be evaluated.

Has 3 parameters, a conditional expression and 2 block!s

either returns the value returned from the conditionally evaluated block!.
Examples
either 3 > 2 [print "Indeed!"][print "Nope!"]
Indeed!

either "ABC" = "abc" [print "The same!"] [print "Different!"]
The same!
; Be careful! Contrary to what is common use in most other programming
; languages, Red considers uppercase and lowercase letters to be equal.

either 2 = 2.0 [print "Equal!"][print "Not equal!"]
Equal!

either 2 == 2.0 [print "Equal!"][print "Not equal!"]
Not equal!
top alphanumeric-index category-index

Red word:    empty?    type=function!

Categories to which this word belongs: Series, String manipulation, Type Checking

Description
The word empty? checks whether a series! is empty.
Examples
; -------------------------------------------------------------------------
; A few examples
; -------------------------------------------------------------------------
red>> empty? []
== true

red>> empty? [1] ; Not empty - contains a number
== false

red>> empty? [ [] ] ; Not empty - contains a block!
== false

red>> empty? "x" ; Not empty - contains a character
== false

red>> empty? ""
== true

red>> empty? { "" } ; Not empty - contains a 4 character string
== false
top alphanumeric-index category-index

Red word:    enbase    type=native!

Categories to which this word belongs: Unknown

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    equal?    type=native!

Categories to which this word belongs: Comparison, Type Checking

Description
The word equal? returns true if two values are equal.  

This is the functional form of the infix word =. Look
there for more details.
Examples
red>> equal? [1 2 3] [1 2 3]
== true
top alphanumeric-index category-index

Red word:    error!    type=datatype!

Categories to which this word belongs: Datatypes

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    error?    type=function!

Categories to which this word belongs: Error, Type Checking

Description
The word error? returns true if the value is of 
type error!. Otherwise false is returned.

This can be used to check the result from try.
Examples
red>> error? try [2 + "3"]
== true

red>> error? try[2 + 3]
== false
top alphanumeric-index category-index

Red word:    eval-set-path    type=function!

Categories to which this word belongs: Evaluation

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    even?    type=action!

Categories to which this word belongs: Math

Description
The word even? returns true if a number! is even.
Else returns false.

Has 1 numeric parameter, which should be an integer!.
Examples
even? -4
== true

even? 77
== false
top alphanumeric-index category-index

Red word:    event!    type=datatype!

Categories to which this word belongs: Datatypes

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    exclude    type=native!

Categories to which this word belongs: Series, String manipulation

Description
The word exclude returns a new value, which is the first 
argument where elements of the second argument are excluded.

With strings, difference in case is not significant.

The argument types can be:
block! hash! string! bitset! typeset!

Refinements:
/case - use case sensitive comparison.
/skip - treat the series! as fixed size records.
Specify the size as an integer!.
Examples
red>> exclude [1 2 3 4 5 6] [2 4 6]
== [1 3 5]
; Exclude evens

red>> exclude "The Great Wall Of China" "aeiou"
== "Th GrWlfCn"
; Exclude vowels, ignoring case

red>> exclude/case "The Great Wall Of China" "aeiou"
== "Th GrtWlOfCn"
; Exclude vowels, regarding case - note the letter "O"
top alphanumeric-index category-index

Red word:    exists?    type=routine!

Categories to which this word belongs: Directories, Files

Description
The word exists? returns true if its argument is an existing path!
or false otherwise.
Examples
red>> exists? %/e/drunk
== false

red>> exists? %/e/src
== true
top alphanumeric-index category-index

Red word:    exit    type=native!

Categories to which this word belongs: Exiting, Functions

Description
The word exit exits a function! without returning a value.

Has no parameters.
Examples
fun1: func [p1] [
fun2 p1
print "fun2 completed"
]

fun2: func [p2] [
print "Before exit check ..."
if p2 = "exit" [exit]
print "After exit check"
]

fun1 "abc"
Before exit check ...
After exit check
fun2 completed

fun1 "exit"
Before exit check ...
fun2 completed
top alphanumeric-index category-index

Red word:    exp    type=native!

Categories to which this word belongs: Math

Description
The word exp raises E (the natural number) to the power supplied.

Has one number! parameter.
Examples
x: exp 0
== 1.0

x: exp 1
== 2.71828182845905

exp -1
== 0.367879441171442
top alphanumeric-index category-index

Red word:    extend    type=native!

Categories to which this word belongs: Maps, Objects

Description
The word extend extends an object! or map! value 
with a list of key and value pairs. The first argument is modified.

The first argument must be object! or map!.
The second argument must be block!, hash! or map!

Refinements:
/case - use case-sensitive comparison
Examples
red>> users: make map! ["John23" "safe3" "DingSnooker" "mypasswd"]
== #(
"John23" "safe3"
"DingSnooker" "mypasswd"
)
; Create a map of 2 users and their passwords.

red>> more-users: make map! ["Jane" "pass123" "Sue" "secret"]
== #(
"Jane" "pass123"
"Sue" "secret"
)
; Create another map!

red>> extend users more-users
== #(
"John23" "safe3"
"DingSnooker" "mypasswd"
"Jane"... ;truncated output at the console
; Extend the first map! with the second.

red>> print users
"John23" "safe3"
"DingSnooker" "mypasswd"
"Jane" "pass123"
"Sue" "secret"
; Show all the users in the first map!

red>> extend users make map! ["JOHN23" "newPassword"]
== #(
"John23" "newPassword"
"DingSnooker" "mypasswd"
...
; Modify an existing map!

red>> print users
"John23" "newPassword"
"DingSnooker" "mypasswd"
"Jane" "pass123"
"Sue" "secret"
; Note: new password for John23 (case-insensitive)
top alphanumeric-index category-index

Red word:    extract    type=function!

Categories to which this word belongs: Series, String manipulation

Description
The word extract extracts a value from a series! at 
regular intervals, returning a new series!.

Arguments are:
1. a series!
2. a skip size of type integer!.

Refinements:
/index - extract from an offset position (integer!).
/into - we provide an output series! instead
of creating a new one.
The results will be appended to the series!.
Examples
red>> extract [1 2 3 4 5 6 7] 3
== [1 4 7]
; Extracts every 3rd element of a block!.

red>> extract "abcdefghij" 2
== "acegi"
; Extracts every 2nd element of a string!.

red>> extract/index "abcdefghij" 2 4
== "dfhj"
; Start from an offset position (position = 4 at char! #"d")

red>> buffer: []
== []
; Create an empty buffer for results.

red>> extract/into [1 2 3 4 5 6 7] 2 buffer
== [1 3 5 7]

red>> extract/into [10 20 30 40 50 60] 2 buffer
== [1 3 5 7 10 30 50]

red>> buffer
== [1 3 5 7 10 30 50]
; The accumulated results in the buffer.
top alphanumeric-index category-index

Red word:    extract-boot-args    type=function!

Categories to which this word belongs: System Related

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    false    type=logic!

Categories to which this word belongs: Boolean, Constants

Description
The word false represents the boolean value false. 
Is of datatype logic!
Examples
1 = 2
== false
top alphanumeric-index category-index

Red word:    fifth    type=function!

Categories to which this word belongs: Series, String manipulation

Description
The word fifth returns the fifth value in a series!. 

The argument can be one of:
series! tuple!

If there is no fifth item, then none is returned.
Examples
red>> fifth [1 2 3 4 5 6 7]
== 5

red>> fifth "ABCDEFG"
== #"E"

red>> fifth 12.16.13.15.22
== 22

red>> fifth [1 2 3]
== none
; No fifth element found
top alphanumeric-index category-index

Red word:    file!    type=datatype!

Categories to which this word belongs: Datatypes

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    file?    type=function!

Categories to which this word belongs: Files, Type Checking

Description
The word file? returns true if its argument is a file!.  

In Red, a file! type value is preceded by %.
If spaces are needed in a file name, enclose it in quotes or use hex %20, as in:
%"my files/"
%/my%20files/

In Windows the drive letter is part of the path!, like so:
%/c/windows/system32/xyz.dll

Absolute path!s start with %/ and relative path!s just with %.
Examples
red>> my-data: %/top/personal/stuff.txt
== %/top/personal/stuff.txt
; Absolute path

red>> file? my-data
== true

red>> file? %work.doc
== true
; Relative path

red>> file? %/folder1/folder2/
== true
; A path can also be a directory


top alphanumeric-index category-index

Red word:    find    type=action!

Categories to which this word belongs: Series, String manipulation

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    first    type=function!

Categories to which this word belongs: Series, String manipulation

Description
The word first returns the first value in a series!. 

The argument can be one of:
series! tuple! pair!

If there is no first item, none is returned.
Examples
red>> first [3 4 5]
== 3
; First of a block!.

red>> first "ABC"
== #"A"
; First of a string!.

red>> first []
== none
; There is no first value here.

red>> first 22.33.44
== 22
; First of a tuple!.

red>> first 200x400
== 200
; First of a pair!.
top alphanumeric-index category-index

Red word:    flip-exe-flag    type=function!

Categories to which this word belongs: System Related

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    float!    type=datatype!

Categories to which this word belongs: Datatypes

Description
The datatype! float! represents a number! type containing 
IEEE-754 64-bit floating point numbers.

In literals the e-notation can be used.

Floats that cannot be represented are NaN (Not a Number).
Examples
; -------------------------------------------------------------------------
; Some examples
; -------------------------------------------------------------------------
red>> 3e2
== 300.0

red>> 3.5 / 2.1
== 1.666666666666667

red>> 4 / 2.0
== 2.0

red>> 3e2 + 1
== 301.0

red>> 1.0 / 0
*** Math error: attempt to divide by zero
*** Where: /
top alphanumeric-index category-index

Red word:    float?    type=function!

Categories to which this word belongs: Type Checking

Description
The word float? returns true if its argument is a float! type, 
otherwise false.
Examples
red>> float? 1.23
== true

red>> float? 3
== false
; No decimal point

red>> float? 3.0
== true

red>> float? "3"
== false
; Is a string

top alphanumeric-index category-index

Red word:    forall    type=native!

Categories to which this word belongs: Iteration

Description
The word forall evaluates its body, moving through the 
provided series! one position at a time.

Note that it does not use a single value from the series! for each
repetition, as foreach does. Instead, it increments the index position
of the series!.
Examples
numbers: [1 2 -4 8 -16]

forall numbers [
print numbers
]
1 2 -4 8 -16
2 -4 8 -16
-4 8 -16
8 -16
-16

forall numbers [
if (first numbers) >= 0 [
print first numbers
]
]
1
2
8
top alphanumeric-index category-index

Red word:    foreach    type=native!

Categories to which this word belongs: Iteration

Description
The word foreach evaluates its body (a block!) for each value in a series!.

A variable (or block! of variables) must be provided, and foreach will take
each value in the series! as the iteration proceeds.

The arguments are:
1. a variable or block! of variables.
2. a series!, e.g. block!, vector!, string! etc
3. a block! - the body, executed for each iteration
Examples
foreach country ["China" "Vietnam"  "Thailand"] [
print country
]
China
Vietnam
Thailand
; Assigns the values in the block in turn to the variable "country"

country-series: ["China" "Vietnam" "Thailand"]
foreach country country-series [
print country
]
China
Vietnam
Thailand
; Instead of using a literal block, you can also use a variable holding a block.

foreach character "Red" [
print character
]
R
e
d
; Prints in turn each cgaracter of the string specified.

capital-series: ["China" "Beijing" "USA" "Washington" "UK" "London"]
foreach [country city] capital-series [
prin country
prin " - capital is - "
print city
]
China - capital is - Beijing
USA - capital is - Washington
UK - capital is - London
; The prin function prints without outputting a newline.
top alphanumeric-index category-index

Red word:    forever    type=native!

Categories to which this word belongs: Iteration

Description
The word forever evaluates a block! body repeatedly (= forever).
The word break can be used to exit the loop if required.
Examples
forever [
r: random 10
print r
if r > 5 [break]
]
3
7
; This ends when r gets a value higher than 5

forever [
print "hi"
]
"hi"
; The line above will be printed eternally ...
top alphanumeric-index category-index

Red word:    form    type=action!

Categories to which this word belongs: Conversion, Formatting

Description
The form word converts a value to a string!, in a user-friendly format.

NOTE that, depending on the type, the resulting text might not contain extra
type information (such as [ ] { } and "") as would be produced by mold.

It has one argument, a value.

Refinements:
/part - an integer! value limiting the length of the result string!
Examples
Because the Red console has an effect on formatting, we will use print.

red>> print form "ABCDEFG"
ABCDEFG

red>> print form/part "ABCDEFG" 2
AB

red>> print form #"Z"
Z

red>> print form {The Great
Wall Of
China}
The Great
Wall Of
China

red>> print form [1 2 3 4 5 6]
1 2 3 4 5 6

red>> print form/part [1 2 3 4 5 6] 4
1 2
top alphanumeric-index category-index

Red word:    fourth    type=function!

Categories to which this word belongs: Series, String manipulation

Description
The word fourth returns the fourth value in a series!. 

The argument can be one of:
series! tuple!

If there is no fourth item, none is returned.
Examples
red>> fourth [1 2 3 4 5 6 7]
== 4

red>> fourth "ABCDEFG"
== #"D"

red>> fourth [1 2 3]
== none
; No fourth value found!

red>> fourth 22.33.1.255
== 255
top alphanumeric-index category-index

Red word:    func    type=native!

Categories to which this word belongs: Functions

Description
The word func is used to create functions.  

Items (variables etc) referred to in the body of a func are assumed to be global.

In almost any case it is better to use the word function.

Arguments:
1. block! of:
- function arguments
- refinements
- local variable definitions
2. the function body, a block!
Examples
; Using a global variable
add-up: func[a b] [
number: a + b
print number ; Global
]
number: 0 ; Global
add-up 3 5
print number ; Global
8 ; Global
8 ; Global

; Shadowing a global variable
add-up2: func [a b /local number] [
number: a + b
print number ; Local
]
number: 20 ; Global
add-up2 3 5
print number ; Global
8 ; Local
20 ; Local

; Using a refinement without a value
add-up3: func [a b /neg /local temp] [
temp: a + b
; Note that a refinement is a boolean
if neg [
temp: temp * -1
]
print temp
]
add-up3 3 5
8
add-up3/neg 3 5
-8

; Using a refinement with a value
add-up4: func [a b /c cval /local temp] [
temp: a + b
if c [
temp: temp + cval
]
print temp
]
add-up4 3 5
8
add-up4/c 3 5 6
14
top alphanumeric-index category-index

Red word:    function    type=native!

Categories to which this word belongs: Functions

Description
The word function is used to define functions. 

Functions can accept arguments and return a result.

The general pattern of defining a function is:
my-function-name: function [spec] [
body i.e. code
]

In the spec part the following can be present:

- definition of arguments in the form:
name [type1 type2 ...]

- definition a possible return types:
return: [type1 type2 ...]

- /local followed by all variables that should be local to the
function
Note this should not be used here, because function
applies /local implicitly to all variables, unless
/extern is specified

- /extern followed by all variables that should not be defined as
local. This means that these variables should be
available in global scope.

As stated above: variables referred to in the body of a function are
assumed to be local.

In almost any case it is better to use the word function than func,
because function provides out of the box what has to be specified
explicitly with func otherwise.

If we try to pass wrong types to a function, a run-time message
occurs during interpretation, or at execution time if we compiled it; the
lack of a compilation error message concerning invalid argument types
is due to the flexible way that Red handles types.

Returning from a function:

- exit - return without avalue

- return - return with a value
Examples
; -------------------------------------------------------------------------
; Shadowing a global variable
; -------------------------------------------------------------------------
add-up2: function [a b ] [
number: a + b
print number ; Local
]

number: 20 ; Global

red>> add-up2 3 5
8 ; Local

red>> print number
20 ; Global

; -------------------------------------------------------------------------
; Specify the type of the arguments
; -------------------------------------------------------------------------
show-bigger: function [
a[integer!]
b[integer!]
][
either a > b [
print a
][
print b
]
]

red>> show-bigger 44 55
55

red>> show-bigger 4 + 5 10
10

red>> show-bigger 4
*** Script error: show-bigger is missing its b argument
*** Where: show-bigger

red>> show-bigger "x" "y"
*** Script error: show-bigger does not allow string! for its a argument
*** Where: show-bigger

; -------------------------------------------------------------------------
; Allow multiple types for an argument - Generic functions
; -------------------------------------------------------------------------
show-bigger: function [
a[integer! float!]
b[integer! float!]
]

; -------------------------------------------------------------------------
; Or use a type that has other types as its subclasses
; -------------------------------------------------------------------------
show-bigger: function [
a[number!]
b[number!]
]

; -------------------------------------------------------------------------
; Returning a value from a function by default
; -------------------------------------------------------------------------
a-result: function[][
39
40 + 2 ; Last expression in a function is the return value
]

red>> print a-result
42

; -------------------------------------------------------------------------
; Returning a value from a function using return
; -------------------------------------------------------------------------
a-result: function[][
39
return 40 + 2
]

red>> print a-result
42

; -------------------------------------------------------------------------
; Using the returned value in an expression
; -------------------------------------------------------------------------
bigger: function [
a[number!]
b[number!]
][
either a > b [
a
][
b
]
]

red>> 2 + bigger 3 4
6

; -------------------------------------------------------------------------
; Sometimes we need parenthesis when calling a function
; -------------------------------------------------------------------------
red>> bigger (bigger 3 4) (bigger 5 6)
6

; -------------------------------------------------------------------------
; But most of the time it works without parenthesis
; -------------------------------------------------------------------------
red>> bigger bigger 4 5 6
6

; -------------------------------------------------------------------------
; Pass by value / by reference
; -------------------------------------------------------------------------

; When we pass scalar types (i.e. single items, such as a number!,
; a char!, a pair!) as arguments, a copy of their value is passed
; to the function!.

; When we pass a series! a reference is passed instead. The reason is
; that series! can be quite large; copying them would cost too much.

; Passing by reference makes it possible to change the series! from
; within a function!.

; Here an example - the series! will be changed in global scope!

my-append: function [data-block [block!] ][
append data-block -999
]

red>> numbers: [45 33 87 55]
== [45 33 87 55]

red>> my-append numbers
== [45 33 87 55 -999]

red>> numbers
== [45 33 87 55 -999]

; -------------------------------------------------------------------------
; A series! local to a function! - closing over a series!
; -------------------------------------------------------------------------

; A local series! when instantiated from a series! without
; copying, will keep its value over function calls!
; Note that this also applies to string!s

x-s: function[] [
xblock: [] ; The [] is modified each time calling the function!
append xblock "X"
print mold xblock
]

red>> x-s
["X"]

red>> x-s
["X" "X"]

red>> x-s
["X" "X" "X"]

; -------------------------------------------------------------------------
; Avoid the previous situation by copying the series! to initialize it
; -------------------------------------------------------------------------
x-s: function[] [
xblock: copy [] ; On each call we get a fresh new block!
append xblock "X"
print mold xblock
]

red>> x-s
["X"]

red>> x-s
["X"]

red>> x-s
["X"]

; -------------------------------------------------------------------------
; Comments in function! definitions
; -------------------------------------------------------------------------
bigger: function [
"return the bigger of 2 numbers"
arg1[number!] "first number argument"
arg2[number!] "second number argument"
][
either arg1 > arg2 [
arg1
][
arg2
]
]

red>> help bigger
USAGE:
bigger arg1 arg2
DESCRIPTION:
return the bigger of 2 numbers. ; Our docstring
bigger is of type: function!
ARGUMENTS:
arg1 [number!] => first number argument.
arg2 [number!] => second number argument.
REFINEMENTS:

; -------------------------------------------------------------------------
; Using refinements as options
; -------------------------------------------------------------------------
red>> a: [1 9 3 8 2 7 5 4 6]
== [1 9 3 8 2 7 5 4 6]

red>> sort a ; No refinement
== [1 2 3 4 5 6 7 8 9]

red>> a ; Note that sort changes the series!
== [1 2 3 4 5 6 7 8 9]

red>> sort/reverse a ; With /reverse refinement
== [9 8 7 6 5 4 3 2 1]

; -------------------------------------------------------------------------
; Using refinements needing an extra argument
; -------------------------------------------------------------------------
red>> sort/part a 4 ; /part refinement needs an extra argument
== [6 7 8 9 5 4 3 2 1]

red>> sort/reverse/part a 4 ; Combining these 2 refinements
== [9 8 7 6 5 4 3 2 1]

; -------------------------------------------------------------------------
; Using the /neg refinement as an option
; -------------------------------------------------------------------------
add-up: function [a b /neg] [
temp: a + b
; Note that a refinement is a boolean
if neg [
temp: temp * -1
]
return temp
]

red>> add-up3 3 5
8

red>> add-up3/neg 3 5
-8

; -------------------------------------------------------------------------
; Using refinements /c and /d with extra arguments
; -------------------------------------------------------------------------
add-up: function [a b /c cval /d dval] [
temp: a + b
; Note that a refinement is a boolean
if c [
temp: temp + cval
]
if d [
temp: temp - dval
]
return temp
]

red>> add-up 3 5
== 8

red>> add-up/c 3 5 3
== 11

red>> add-up/d 3 5 3
== 5

red>> add-up/c/d 3 5 4 5 ; Note that /c = 4 and /d = 5
== 7

red>> add-up/d/c 3 5 4 5 ; Note that /c = 5 and /d = 4
== 9

; -------------------------------------------------------------------------
; Forward referencing a function!
; -------------------------------------------------------------------------

; By default you should define your function!s at the top of your
; program and call them later on.

; However, this is not required if and only if the call is from within
; another function!

show-all: function [] [
print "Powers of ten:"
display-powers ; Works from inside a function! body
]

display-powers: function[] [
print [10 1000 10000 100000]
]

red>> show-all
Powers of ten:
10 1000 10000 100000

; -------------------------------------------------------------------------
; Assigning functions to variables - use a prefix colon
; -------------------------------------------------------------------------
red>> sorteren: :sort
== make action! [[
{Sorts a series (modified); default sort or...

red>> sorteren [2 5 3 1 4]
== [1 2 3 4 5]

red>> sorteren/reverse [2 5 3 1 4]
== [5 4 3 2 1]

; -------------------------------------------------------------------------
; Returning from a function without a result value
; -------------------------------------------------------------------------

void: function [] [
exit
]

red>> mold void
== "unset"

; -------------------------------------------------------------------------
; Returning a result value
; -------------------------------------------------------------------------

val: function [] [
return "My message"
]

red>> val
== "My message"

; -------------------------------------------------------------------------
; The /extern refinement
; -------------------------------------------------------------------------

test: function [
/extern var1
] [
var1: 11
var2: 22
]

red>> var1: 1
== 1

red>> var2: 2
== 2

red>> test
== 22

red>> var1
== 11 ; Changed because of /extern - global scope

red>> var2
== 2 ; Shadowed - global scope not changed
top alphanumeric-index category-index

Red word:    function!    type=datatype!

Categories to which this word belongs: Datatypes, Functions

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    function?    type=function!

Categories to which this word belongs: Type Checking

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    get    type=native!

Categories to which this word belongs: Word Manipulation

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    get-current-dir    type=routine!

Categories to which this word belongs: Directories, Files

Description
The word get-current-dir returns the current directory the program is using.  

When a program begins executing, its current directory is set to the one it is
stored in, but the current directory can be changed during run time.
Examples
; The example program is filefolders.exe, stored in this file structure:
; C:\red\file-dir-tests\
; filefolders.exe
; folder1A\
; folder1B\
; folder1C\

print ["Current-dir:" get-current-dir]
Current-dir: C:\red\file-dir-tests

cd %folder1A
print ["Current-dir:" get-current-dir]
Current-dir: C:\red\file-dir-tests\folder1A

cd %..
print "Current-dir: "print get-current-dir
Current-dir: C:\red\file-dir-tests
top alphanumeric-index category-index

Red word:    get-env    type=native!

Categories to which this word belongs: Unknown

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    get-path!    type=datatype!

Categories to which this word belongs: Datatypes

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    get-path?    type=function!

Categories to which this word belongs: Files, Type Checking

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    get-word!    type=datatype!

Categories to which this word belongs: Datatypes

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    get-word?    type=function!

Categories to which this word belongs: Type Checking

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    greater-or-equal?    type=native!

Categories to which this word belongs: Comparison

Description
The word greater-or-equal? is the functional form of the >=
infix word.
Examples
red>> greater-or-equal? 44 33
== true
top alphanumeric-index category-index

Red word:    greater?    type=native!

Categories to which this word belongs: Comparison

Description
The word greater? is the functional form of the > infix word.
Examples
red>> greater? 44 33
== true
top alphanumeric-index category-index

Red word:    halt    type=function!

Categories to which this word belongs: Exiting, System Related

Description
The halt word stops the interpretation of a script immediately.

Always returns a value of 1.
Examples
fun1: func [p1] [
fun2 p1
print "fun2 completed"
]

fun2: func [p2] [
print "Before halt check ..."
if p2 = "halt" [halt]
print "After halt check"
]

fun1 "abc"
Before halt check ...
After halt check
fun2 completed

fun1 "halt"
Before halt check ...
top alphanumeric-index category-index

Red word:    has    type=native!

Categories to which this word belongs: Functions

Description
The word has is a way to define a function that does have local variables 
but has no arguments.

It is followed by a block! of local variable names, and a block! of code.
Examples
calc-hours: has  [number] [
number: 365 * 24 ; number is local
print number
]
calc-hours
8760
top alphanumeric-index category-index

Red word:    hash!    type=datatype!

Categories to which this word belongs: Datatypes

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    hash?    type=function!

Categories to which this word belongs: Type Checking

To do by red-by-example team ...

top alphanumeric-index category-index
Categories to which this word belongs: Series, String manipulation

Description
The word head resets the index of a series! to its start.

Note that you can use the word head? to test if a series! is at postion 1.

Note that you can use the word index? to obtain the current index!
Examples
red>> x: [1 2 3 4 5 6 7]
== [1 2 3 4 5 6 7]

red>> index? x
== 1

red>> head? x
== true

red>> x: skip x 3
== [4 5 6 7]

red>> index? x
== 4

red>> head? x
== false

red>> x: head x
== [1 2 3 4 5 6 7]

red>> index? x
== 1

red>> head? x
== true
top alphanumeric-index category-index

Red word:    head?    type=action!

Categories to which this word belongs: Series, String manipulation

Description
The word head? checks whether a series! index is at the head
position (= position 1) and returns true if it is at head or false
otherwise.

Note that you can use the word index? to obtain the current index!
Examples
red>> x: [1 2 3]
== [1 2 3]

red>> head? x
== true

red>> index? x
== 1

red>> x: next x
== [2 3]

red>> head? x
== false

red>> index? x
== 2
top alphanumeric-index category-index

Red word:    help    type=function!

Categories to which this word belongs: Documentation, Help & Debug

Description
The help word provides an overview of Red words and datatypes.
You may also type ? instead of help.

Help has 1 argument:
- a Red word!:
in this case help displays the help info for exactly that word!
- or a string!:
in this case help displays every piece of help info where this
string! occurs.
Examples
red>> help add
USAGE:
add value1 value2

DESCRIPTION:
Returns the sum of the two values.
add is of type: action!

ARGUMENTS:
value1 [number! char! pair! tuple! vector!]
value2 [number! char! pair! tuple! vector!]

REFINEMENTS:

red>> help *
USAGE:
value1 * value2

DESCRIPTION:
Returns the product of two values.
* is of type: op!

ARGUMENTS:
value1 [number! char! pair! tuple! vector!]
value2 [number! char! pair! tuple! vector!]

REFINEMENTS:

red>> help native!
all => Evaluates, returning at the first that is not true
any => Evaluates, returning at the first that is true
arccosine => Returns the trigonometric arccosine (in degrees by default)
arcsine => Returns the trigonometric arcsine (in degrees by default)
arctangent => Returns the trigonometric arctangent (in degrees by default)
... rest of output omitted here ...

red>> help "contr"
continue => Throws control back to top of loop
throw => Throws control back to a previous catch

red>> help "sine"
acos => Returns the trigonometric arccosine
arccosine => Returns the trigonometric arccosine (in degrees by default)
arcsine => Returns the trigonometric arcsine (in degrees by default)
asin => Returns the trigonometric arcsine
cos => Returns the trigonometric cosine
cosine => Returns the trigonometric cosine
sin => Returns the trigonometric sine
sine => Returns the trigonometric sine
top alphanumeric-index category-index

Red word:    if    type=native!

Categories to which this word belongs: Conditional branching

Description
The word if evaluates a conditional expression. 
If the result thereof is true, the block! will be evaluated.
If false nothing happens.

Has 2 parameters:
1. a conditional expression
2. a block!.

If returns the resulting value of the block! if the condition is true and
else returns none.

Warning:
The if word is a pitfall for Red n00bs, because it doesn't have an else block!.
The either word provides what programmers would expect.
Examples
if 3 > 2 [print "3 > 2"]
3 > 2

if 3 > 2 [print "3 > 2"] [print "2 > 3"]
3 > 2
== [print "2 > 3"]
; This is a n00b error.
; The last block is not a part of the if, so the block is evaluated
; as a stand-alone block, which returns the block itself!

if 2 = 2.0 [print "Different datatypes, but still equal!"]
Different datatypes, but still equal!

if 2 == 2.0 [print "Different datatypes NOT equal!"]
none
top alphanumeric-index category-index

Red word:    image!    type=datatype!

Categories to which this word belongs: Datatypes

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    image?    type=function!

Categories to which this word belongs: Type Checking

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    in    type=native!

Categories to which this word belongs: Objects

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    index?    type=action!

Categories to which this word belongs: Series, String manipulation

Description
The word index? returns the current index of a series! relative to the head, 
or of a word in a context.

The argument can be:
series! word!

In Red, the name referring to a series! need not indicate the first item.
It can be moved to index any part of a series.
It is not like an array name in traditional languages.

NOTE: when you assign a variable to a series, that variable points to the same
series! as the one it is assigned to. This can cause big trouble!!!!
Normally always use copy to avoid that.
Examples
; Create a series
red>> numbers: [2 4 8 3 9 27]
== [2 4 8 3 9 27]

; Are we at the start of "numbers"? (index starts at 1, not zero)
red>> index? numbers
== 1

; Find returns the part of the series! from the found item's position
; or none if not found
red>> n: find numbers 9
== [9 27]

; "n" is also a series!
red>> n
== [9 27]

; But "n" still refers to the series! called "numbers"
red>> index? n
== 5

; We could write this more concisely
red>> index? find numbers 9
== 5

; Show that "n" is just a "pointer" into "numbers"
; The "head"of "n" is the same as the "head" of "numbers"
; because the underlaying series! is exactly the same!
red>> n: head n
== [2 4 8 3 9 27]

; NOTE: beware that directly assigning to a series! can wreak havoc!
red>> s1: [1 2 3 4]
== [1 2 3 4]
red>> s2: next s1
== [2 3 4]
red>> append s2 5
== [1 2 3 4 5]
; Append always returns the whole series! and does not consider the index
red>> s2
== [2 3 4 5]
; "s2" is modified
red>> s1
= [1 2 3 4 5]
; "s1" also modified!

; NOTE: avoid this "problem" by using copy
red>> s1: [1 2 3 4]
== [1 2 3 4]
red>> s2: copy next s1
== [2 3 4]
red>> append s2 5
== [2 3 4 5]
red>> s2
== [2 3 4 5]
; "s2"is modified
red>> s1
== [1 2 3 4]
; But "s1" is left intact!
top alphanumeric-index category-index

Red word:    input    type=function!

Categories to which this word belongs: Input

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    insert    type=action!

Categories to which this word belongs: Series, String manipulation

Description
The word insert inserts (a) value(s) at a series! index.  

The original series! is modified and insert returns the part of the series!
from the position following the insert.

The 2 arguments are:
1. a series! i.e series! bitset! map!
2. a value, which can be of any type

Refinements:
/part - Limit the number of values inserted.
We provide a length of type: number!
or a "pointer" of type series!
/only - insert block! types as single values (overrides /part).
Normally each value in a block! would be separately inserted.
/dup - Duplicate the inserted values. Must provide a count of type number!

NOTE: insert is a destructive operation! It alters its argument.
Most of the time you need to copy before using insert!
Examples
red>> s: "this is a string"
== "this is a string"

; Insert at current index - which is 1.
red>> insert s "I think "
== "this is a string"
red>> s
== "I think this is a string"

; Insert at other positions (e.g. after "d")
red>> letters: "abcdefg"
== "abcdefg"
red>> insert find letters "d" "XX"
== "defg"
; This result is the result of "find", not of "insert"!
red>> letters
== "abcXXdefg"
; Now you see the result of "insert".

; Insert at the tail
red>> insert tail letters "-END-"
== ""
; Again: this is the result of "find".
red>> letters
== "abcXXdefg-END-"
; And this of "insert".

; Insert a duplicate, 5 times
red>> insert/dup s "-" 5
== "I think this is a string"
red>> s
== "-----I think this is a string"

; Make a string for /part
red>> s2: "YES it is"
== "YES it is"
; Only insert the first 6 characters of "s2" into "s".
red>> insert/part s s2 6
== "-----I think this is a string"
red>> s
== "YES it-----I think this is a string"

; We need a block type to illustrate /only.
red>> a-block: [3 4 5]
== [3 4 5]
; Normal insert, without /only.
red>> insert a-block [33 44 55]
== [3 4 5]
; Note the separate items.
red>> a-block
== [33 44 55 3 4 5]

; Reset the block.
red>> a-block: [3 4 5]
== [3 4 5]
; Now use /only
red>> insert/only a-block [33 44 55]
== [3 4 5]
; Now the block is inserted, instead of its elements.
red>> a-block
== [[33 44 55] 3 4 5]
top alphanumeric-index category-index

Red word:    integer!    type=datatype!

Categories to which this word belongs: Datatypes

Description
The datatype! integer! represents a number! type containing 
32 bit whole signed numbers.
Examples
; -------------------------------------------------------------------------
; Some examples
; -------------------------------------------------------------------------
red>> 33 + 55
== 88

red>> 6 / 7
== 0 ; Dividing 2 integers gives rounded result

red>> 6.0 / 7
== 0.8571428571428571

red>> add 6 7
== 13
top alphanumeric-index category-index

Red word:    integer?    type=function!

Categories to which this word belongs: Type Checking

Description
The word integer? returns true if its argument is an integer! type, 
otherwise false.

Its argument can be any type.
Examples
; A literal integer value
red>> integer? 123
== true

; A variable holding an integer value
red>> a: 456
== 456

red>> integer? a
== true

red>> integer? 22x30
== false

red>> integer? 12.3
== false
top alphanumeric-index category-index

Red word:    intersect    type=native!

Categories to which this word belongs: Sets

Description
The word intersect returns the intersection (the common items) of two sets. 

The arguments can be sets of:
block! hash! string! bitset! typeset!

To create a set with no duplicate items, the unique function can be used.

Refinements:
/case - use case-sensitive comparison.
/skip - treat the series! as fixed size records.
The specified size is an integer!.
Examples
; Create 2 series
red>> list1: ["India" "China" "Vietnam" "Singapore"]
== ["India" "China" "Vietnam" "Singapore"]

red>> list2: ["uk" "china" "USA" "India" "France"]
== ["uk" "china" "USA" "India" "France"]

; Common values in these sets
red>> intersect list1 list2
== ["India" "China"]

; When case sensitive
red>> intersect/case list1 list2
== ["India"]
top alphanumeric-index category-index

Red word:    is    type=op!

Categories to which this word belongs: none

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    issue!    type=datatype!

Categories to which this word belongs: Datatypes

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    issue?    type=function!

Categories to which this word belongs: Type Checking

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    keys-of    type=function!

Categories to which this word belongs: Functions, Reflection

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    last    type=function!

Categories to which this word belongs: Series, String manipulation

Description
The word last returns the last value in a series!.  
If the series! is empty, none is returned.

Its single argument is a series!.
Note that a string! is a series of char!.
Examples
red>> last ["cat" "dog" "bird"]
== "bird"

red>> last [33 44]
== 44

red>> last []
== none

red>> last "abcd"
== #"d"

top alphanumeric-index category-index

Red word:    last-lf?    type=routine!

Categories to which this word belongs: Input, Output

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    layout    type=function!

Categories to which this word belongs: GUI (VID)

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    length?    type=action!

Categories to which this word belongs: Series, String manipulation

Description
The word length? returns the number of values in a series!, 
from the current index to the tail.

The length of an empty series! is 0.

The length of none is none.

Its single argument can be one of these types:
series! bitset! map! tuple! none
Examples
red>> length? [10 20 30]
== 3

red>> length? []
== 0

; Tuple
red>> length? 22.33.44.100
== 4

; Find returns the series from the found item (30) onwards,
; which is [30 40 50]
red>> length? find [10 20 30 40 50] 30
== 3

red>> length? none
== none

; Find returns none; then length is none.
red>> length? find [10 20 30 40 50] 123
== none
top alphanumeric-index category-index

Red word:    lesser-or-equal?    type=native!

Categories to which this word belongs: Comparison

Description
The word lesser-or-equal? returns true if the first argument
is less than or equal to the second argument, otherwise false.

It is the functional equivalent of the infix word <=.
Examples
red>> lesser-or-equal? 33 44
== true

red>> "ABC" <= "abc"
== true

red>> "abc" <= "ABC"
== true

red>> [4 8 5] <= [4 2 1]
== false

red>> [4 1 1] <= [4 2 1]
== true
top alphanumeric-index category-index

Red word:    lesser?    type=native!

Categories to which this word belongs: Comparison

Description
The word lesser? returns true if the first argumjent is 
less than the second argument, otherwise false.

It is the functional equivalent of the infix word <.
Examples
red>> lesser? 33 44
== true

red>> lesser? [8 5 2] [ 7 5 2]
== false

red>> lesser? [6 5 2] [ 7 5 2]
== true
top alphanumeric-index category-index

Red word:    list-dir    type=function!

Categories to which this word belongs: Directories, Files

Description
The word list-dir shows a list of all files and directories within the
directory given as its argument.

Refinements:
/col - displays in n columns instead of the default 4
Examples
; -------------------------------------------------------------------------
; Show contents of current directory
; -------------------------------------------------------------------------
red>> list-dir %/e/src
8th/ go/ python/ red/
spiderbasic/

red>> list-dir/col %/e/src 3
8th/ go/ python/
red/ spiderbasic/
red>> list-dir/col %/e/src 2
8th/ go/
python/ red/
spiderbasic/
top alphanumeric-index category-index

Red word:    list-env    type=native!

Categories to which this word belongs: Unknown

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    lit-path!    type=datatype!

Categories to which this word belongs: Datatypes

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    lit-path?    type=function!

Categories to which this word belongs: Type Checking

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    lit-word!    type=datatype!

Categories to which this word belongs: Datatypes

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    lit-word?    type=function!

Categories to which this word belongs: Type Checking

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    ll    type=function!

Categories to which this word belongs: none, Files

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    load    type=function!

Categories to which this word belongs: Files, Input

Description
The word load returns a value or block! of values from a file. 

Text files and certain types of binary files can be handled.

Its argument specifies the path! to the data and can be:
file! url! string! binary!

Refinements:
/part - load a part of the data, where the part length is
integer! or string!
/into - put results into an existing block!, instead
of creating a new block!.
We need then to provide a block! to be used.
/as - specify the type of the data to be loaded;
we need to specify either:
- none -> load data as code
- word! -> e.g. json, html, jpeg, png, etc.
/header - include Red header as a loaded value
/all - does not evaluate Red header
Examples
; one-number.txt has one number in it.
red>> load %one-number.txt
== 234

; This file has 3 numbers, one per line.
; For more than 1 item, a block will be created.
red>> load %three-numbers.txt
== [234 567 789]

; Store the result of load.
red>> some-numbers: load %three-numbers.txt
== [234 567 789]

red>> some-numbers
== [234 567 789]

red>> genres: load %music-types.txt
== ["Blues" "Rock" "Jazz"]

; It is easy to put program code in a file
; and load it ...
red>> prog: load %code-type.txt
== [print "Hello from a block of code in a file!"]

; Use do to execute the result of a load.
red>> do prog
Hello from a block of code in a file!

; face.jpg contains an image, 216 x 216 pixels.
; (the console truncates long values to ... )
red>> p: load %face.jpg
== make image! [216x216 #{
AFB3B6AFB3B6AFB3B6AFB3B6AEB2B5AEB2B5AEB...
top alphanumeric-index category-index

Red word:    log-10    type=native!

Categories to which this word belongs: Math

Description
The word log-10 returns the logarithm (base 10) of its argument.

The argument can be a number! (a float! or an integer! )
Examples
red>> log-10 9.9
== 0.99563519459755

red>> log-10 1000
== 3.0
top alphanumeric-index category-index

Red word:    log-2    type=native!

Categories to which this word belongs: Math

Description
The word log-2 returns the logarithm (base 2) of its argument.

The argument can be a number! (a float! or an integer!)
Examples
red>> log-2 2.1
== 1.070389327891398

red>> log-2 32
== 5.0
top alphanumeric-index category-index

Red word:    log-e    type=native!

Categories to which this word belongs: Math

Description
The word log-e returns the natural (base E) logarithm of its argument.

The argument can be a number! (a float! or an integer!)
Examples
red>> log-e 2.7
== 0.9932517730102835

red>> log-e 3
== 1.09861228866811
top alphanumeric-index category-index

Red word:    logic!    type=datatype!

Categories to which this word belongs: Datatypes

Description
The datatype! logic! consists of two states representing 
true and false.

They are returned from comparisons using > <= etc.

The provided boolean words and their values are:

- the pair:
true = true
false = false

- the pair:
on = true
off = false

- the pair:
yes = true
no = false

Note that on and off and yes and no have no built-in logic.
They are preset words which can be more meaningful in certain situations.
.pre
red>> 3 > 2
== true

red>> a: 3
== 3

red>> answer: a > 2
== true

red>> answer
== true

red>> not answer
== false

red>> if a > 2 [print "bigger"]
bigger

red>> yes
== true

; Note: we get false, not no
red>> not yes
== false

red>> power-switch: off
== false

red>> if power-switch = off [power-switch: on]
== true

; Note, not on but true.
red>> power-switch
== true
top alphanumeric-index category-index

Red word:    logic?    type=function!

Categories to which this word belongs: Type Checking

Description
The word logic? returns true if its argument is of 
the logic! datatype!, otherwise false.

its argument can be on any type.
Examples
red>> open: true
== true

red>> logic? open
== true

red>> large: false
== false

; It is true that 'false' is a logic! type.
red>> logic? large
== true

; Expressions resulting in a logic! result
red>> logic? 3 > 2
== true

red>> logic? 3 + 2
== false

; yes, no, on and off are also logic!
red>> logic? yes
== true

red>> logic? no
== true

red>> logic? on
== true

red>> logic? off
== true
top alphanumeric-index category-index

Red word:    loop    type=native!

Categories to which this word belongs: Iteration

Description
The word loop executes a given block! a given number of times.

Has 2 parameters:
1. a number! (number of times to evaluate the block!)
2. a block! (to be evaluated the specified number of times)

loop has no return value.
Examples
loop 3 [print "Hi!"]
Hi!
Hi!
Hi!

i: 0
loop 10 [i: i + 1]
print ["Value of i =" i]
Value of i = 10
top alphanumeric-index category-index

Red word:    lowercase    type=native!

Categories to which this word belongs: String manipulation

Description
The word lowercase converts a string of characters to lower-case. 

The single argument can be a string or character.

Refinements:
/part - limits to a given length or position.

NOTE: this is a destructive operation. When applying it to a variable,
the variable will be changed!
Examples
red>> lowercase #"A"
== #"a"

red>> lowercase "ABCD EFGH ijk"
== "abcd efgh ijk"

red>> lowercase/part "ABCD EFGH ijk" 2
== "abCD EFGH ijk"
top alphanumeric-index category-index

Red word:    ls    type=function!

This word is a synonym for list-dir
top alphanumeric-index category-index

Red word:    make    type=action!

Categories to which this word belongs: Create, Datatypes

Description
The word make returns a new value, based on a type and a specification for the type.

It has 2 arguments:
1. the datatype!, an example or a prototype value
2. the specification of the new value or the number of items (for vector!).

The actual detail of these arguments depends on the datatype!.

For series! types, the specification is often a value for the initial size
of the series!.
Examples
red>> make block! 10   ;; size 10 initially
== []

red>> make [] 3
== []

red>> make vector! [1 5 3]
== make vector! [1 5 3]

red>> make vector! 6
== make vector! [0 0 0 0 0 0]

v: make vector! 0
== make vector! []
top alphanumeric-index category-index

Red word:    make-dir    type=function!

Categories to which this word belongs: Unknown

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    map!    type=datatype!

Categories to which this word belongs: Datatypes

Description
The datatype! map! represents a series! type.

This datatype provides a dictionary-like data structure, to make it
easy to store key/value pairs while providing very fast lookups.

Note that a map! is NOT a series!, so does not have the
concept of offset or positions.

A map! can have a wide range of types for its keys and values.

Entering a map! in literal format:
#(key1: val1 key2: val2 ... key3: val3)

Note that select and put are case-insensitive about keys.
To make them case-sensitive, use the case refinement, as in select/case.
.pre
; -------------------------------------------------------------------------
; Create 2 users with their respective passwords in a map!
; -------------------------------------------------------------------------
red>> users: make map! ["John23" "safe3" "DingSnooker" "mypasswd"]
== #(
"John23" "safe3"
"DingSnooker" "mypasswd"
)

red>> print users
"John23" "safe3"
"DingSnooker" "mypasswd"

; -------------------------------------------------------------------------
; Retrieve passwords
; -------------------------------------------------------------------------
red>> print select users "john23" ; Note: case insensitive!
safe3

red>> print select users "mr-x"
none ; Not found in the map!

; -------------------------------------------------------------------------
; Add a new user/password
; -------------------------------------------------------------------------
red>> put users "JaneUK" "magicpass"
== "magicpass"

red>> print users
"John23" "safe3"
"DingSnooker" "mypasswd"
"JaneUK" "magicpass"

; -------------------------------------------------------------------------
; Change a password for an existing user
; -------------------------------------------------------------------------
red>> put users "John23" "mygoodPass"
== "mygoodPass"

red>> print users
"John23" "mygoodPass"
"DingSnooker" "mypasswd"
"JaneUK" "magicpass"

; -------------------------------------------------------------------------
; Delete a user
; -------------------------------------------------------------------------
red>> put users "John23" none
== none

red>> print users
"DingSnooker" "mypasswd"
"JaneUK" "magicpass"

; -------------------------------------------------------------------------
; How many users left?
; -------------------------------------------------------------------------
red>> print length? users
2

; -------------------------------------------------------------------------
; Select a user by his key
; -------------------------------------------------------------------------
red>> users: make map! ["John23" "safe3" "DingSnooker" "mypasswd"]
== #(
"John23" "safe3"
"DingSnooker" "mypasswd"
)
red>> select users "John23"
== "safe3"
top alphanumeric-index category-index

Red word:    map?    type=function!

Categories to which this word belongs: Type Checking

Description
The word map? returns true if its argument is a map! datatype!, 
otherwise false.

This datatype! provides a dictionary-like data structure,
storing key/value pairs.
Examples
; Using a map literal
red>> p: #(a: 3 b: 4 c: 5)
== #(
a: 3
b: 4
c: 5
)

; Use make to create a map
red>> users: make map! ["John23" "safe3" "DingSnooker" "mypasswd"]
== #(
"John23" "safe3"
"DingSnooker" "mypasswd"
)

red>> map? users
== true

red>> ages: [1 1949 2 1980 3 1999]
== [1 1949 2 1980 3 1999]

red>> map? ages
== false

; Extending a map with new keys/values:
red>> x: make map! [1 "January" 2 "Februari" 3 "March"]
== #(
1 "January"
2 "Februari"
3 "March"
)

red>> extend x [4 "April" 5 "May"]
== #(
1 "January"
2 "Februari"
3 "March"
4 "April"...

red>> print mold x
#(
1 "January"
2 "Februari"
3 "March"
4 "April"
5 "May"
)

; Retrieving a value using a key.
red>> x/1
== "January"

red>> x/5
== "May"

; Out of range
red>> x/7
== none
top alphanumeric-index category-index

Red word:    max    type=native!

Categories to which this word belongs: Math

Description
The word max returns the greater of its 2 arguments. 

The 2 arguments must be of:
number! series! char!
Examples
red>> max 4 3
== 4

red>> max 3.1 3.11
== 3.11

red>> max #"B" #"C"
== #"C"

red>> max "ABC" "BBC"
== "BBC"

red>> max "ABC" "ABCD"
== "ABCD"

red>> max [1 2 3] [2 2 3 3]
== [2 2 3 3]

top alphanumeric-index category-index

Red word:    min    type=native!

Categories to which this word belongs: Math

Description
The word min returns the smaller of its two arguments. 

There are 2 arguments of type:
number! series! char!
Examples
red>> min  4 3
== 3

red>> min 3.1 3
== 3

red>> min #"B" #"C"
== #"B"

red>> min "ABC" "BBC"
== "ABC"

red>> min "ABC" "ABCD"
== "ABC"

red>> min [1 2 3] [3 2 1 0]
== [1 2 3]
top alphanumeric-index category-index

Red word:    modify    type=action!

Categories to which this word belongs: Unknown

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    modulo    type=function!

Categories to which this word belongs: Math

Description
The word modulo computes the non-negative remainder of the 
first argument divided by the second argument.

The arguments can be of type:
number!
Examples
; 7 divides 2 times, remainder 1
red>> modulo 15 7
== 1

; 2 divides 2 times, remainder 0.4
red>> modulo 6.4 2
== 0.4000000000000004

; 7 divides -3 times, remainder +6
red>> modulo -15 7
== 6
top alphanumeric-index category-index

Red word:    mold    type=action!

Categories to which this word belongs: Formatting

Description
The word mold returns a Red-readable string! representing a value.

This means that, for example, values can be stored in files and re-input to
a program when molded.

Type information is included in the string!for example:
[ ] around a block,
#"" around a character
and { } around multi-line strings

A single argument of any type is required

Refinements
/only - Exclude outer brackets if value is a block!
/all - Return value in loadable format
/flat - Exclude all indentation
/part - Limit the length of the result, where limit is an integer!
Examples
red>> print mold 12.34
12.34

red>> print mold "a string"
"a string"

red>> mold #"A"
#"A"

red>> print mold { The Great
Wall Of
China}
" The Great^/ Wall Of^/China"

red>> print mold [1 2 3]
[1 2 3]

red>> print mold/only [1 2 3]
1 2 3

red>> print mold/part [1 2 3 4 5] 3
[1
top alphanumeric-index category-index

Red word:    move    type=action!

Categories to which this word belongs: Series, String manipulation

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    multiply    type=action!

Categories to which this word belongs: Math

Description
The word multiply multiplies 2 number!s.
This is equivalent to the infix operator *.

Has 2 arguments, which must be of type:
number! char! pair! tuple! vector!
Examples
red>> multiply 3 4.2
== 12.6

red>> multiply 11x20 4
== 44x80

red>> multiply 1.4.5 2
== 2.8.10

red>> v: make vector![2 3 4]
== make vector! [2 3 4]

red>> v2: make vector![20 20 3]
== make vector! [20 20 3]

red>> multiply v v2
== make vector! [40 60 12]
top alphanumeric-index category-index

Red word:    NaN    type=unset!

Categories to which this word belongs: Math

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    NaN?    type=native!

Categories to which this word belongs: Math

Description
The word NaN? returns true if the argument is 'not a number',
otherwise false.

'Not a number' means that it is impossible to represent it internally.

The argument is of type: number!
Examples
; 1.5 is a valid number!
red>> NaN? 3 / 2
== false

; 3 is a valid number!
red>> NaN? square-root 9
== false

; Square root of a negative number.
red>> NaN? square-root -9
== true

top alphanumeric-index category-index

Red word:    native!    type=datatype!

Categories to which this word belongs: Datatypes

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    native?    type=function!

Categories to which this word belongs: Functions, Type Checking

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    negate    type=action!

Categories to which this word belongs: Math

Description
The word negate inverses its argument (positive <-> negative).
Examples
red>> negate 3
== -3

red>> negate -3
== 3

red>> negate 5x4
== -5x-4

red>> negate 5x-4
== -5x4

red>> negate -5x4
== 5x-4
top alphanumeric-index category-index

Red word:    negative?    type=native!

Categories to which this word belongs: Comparison

Description
The word negative? returns true if the numeric parameter 
is less than zero, otherwise false.

NOTE that zero returns false.

Has one numeric parameter.
Examples
negative? -2
== true

negative? 0
== false

negative? 0.1
== false
top alphanumeric-index category-index

Red word:    new-line    type=native!

Categories to which this word belongs: Constants, Output

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    new-line?    type=native!

Categories to which this word belongs: Output, Type Checking

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    next    type=action!

Categories to which this word belongs: Series, String manipulation

Description
The word next moves the index of a series! 1 position towards
the tail (= the end) of the series!.

When a series! index is already at tail position, next won't
change the index; it stays at tail.

The opposite of next is back.
Examples
red>> ser: [1 2 3]
== [1 2 3]

red>> ser: [1 2 3]
== [1 2 3]

red>> next ser
== [2 3]

red>> ser ; next is not destructive
== [1 2 3]

red>> ser: next ser
== [2 3]

red>> ser
== [2 3]

red>> ser: next ser
== [3]

red>> ser
== [3]

red>> ser: next ser
== [] ; We are at tail postion

red>> tail? ser
== true

red>> ser
== []

red>> ser: next ser ; Already at tail - do nothing
== []

red>> tail? ser
== true

red>> ser
== []
top alphanumeric-index category-index

Red word:    no    type=logic!

Categories to which this word belongs: Boolean, Constants

Description
The value no can be used as the boolean value false.
Examples
red>> no
== false

red>> not no
== true
top alphanumeric-index category-index

Red word:    none    type=none!

Categories to which this word belongs: Boolean, Constants

Description
The word none is a special value, and its datatype is none!

none is not the same as an empty block!, empty string!,
zero number! or null char!.

It is an actual value that represents non-existence.

none is returned in certain circumstances from several functions,
primarily those involving series!.
Examples
pick [11 22 33] 2
== 22
; Elements in a block are numbered 1 thru n

pick [11 22 33] 4
== none
; Out of range results in a none value

pick [true false true] 2
== false

pick [true false true] 4
== none
; Out of range results in a none value

a: 123
== 123

type? a
== integer!

a: none
== none
; none is just a value, like 123 before

type? a
== none!

either pick [11 22 33] 4 [print "got it"] [print "problem"]
problem
; In a comparison none behaves the same as false

some-function: func [arg1] [
; code omitted
return none ; no answer found
]
; This function returns none as the return value

answer: some-function 42
== none

print none? answer
true
top alphanumeric-index category-index

Red word:    none!    type=datatype!

Categories to which this word belongs: Datatypes

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    none?    type=function!

Categories to which this word belongs: Type Checking

Description
The word none? returns true if its argument has a none value,
otherwise false.

Its single argument can be of any type.
Examples
red>> none? 3 / 4
== false

; Find searches and returns none if not found
red>> none? find "ABCD" "Z"
== true

; If found, returns the series! from the found item ("BCD").
red>> none? find "ABCD" "B"
== false
top alphanumeric-index category-index

Red word:    normalize-dir    type=function!

Categories to which this word belongs: Directories, Files

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    not    type=native!

Categories to which this word belongs: Bit manipulation, Boolean, Comparison, Logic

Description
The word not returns the logical complement of a value.

NOTE that only the logic! values false and none
return true.

For other types such as integer!, float!, bitset!,
false is returned, irrespective of the data value.

Use complement to perform a bitwise not.
Examples
red>> not (3 > 2)
== false

red>> not (10 > 20)
== true

red>> not 1
== false

red>> not 0
== false

red>> not -1
== false

red>> not none
== true
top alphanumeric-index category-index

Red word:    not-equal?    type=native!

Categories to which this word belongs: Comparison, Type Checking

Description
The word not-equal? returns true if two values (of any type)
are not equal.

When comparing string!s lowercase is considered equal to uppercase.

There is also an infix <> operator, doing the same.
Examples
red>> not-equal? 12 12.0
== false

red>> not-equal? "abc" "abc"
== false

red>> not-equal? "abC" "ABC"
== false
top alphanumeric-index category-index

Red word:    now    type=native!

Categories to which this word belongs: Unknown

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    number!    type=typeset!

Categories to which this word belongs: Datatypes

Description
The datatype! number! is a typeset! containing other datatype!s.
Examples
; -------------------------------------------------------------------------
; Show all subtypes of number!
; -------------------------------------------------------------------------
red>> ? number!
number! is a typeset! of value:
make typeset! [
integer!
float!
percent!
]
top alphanumeric-index category-index

Red word:    object    type=function!

Categories to which this word belongs: Objects

Description
An object is a container that groups data and/or functions within 
one variable.

Red implements 'prototype-based objects'.

Creating new objects is done by cloning existing objects
or the base object! value.

During the creation process, existing field values can be modified
and new fields can be added.

It is a very simple and efficient model to encapsulate your Red code.
Examples
; make an object - a pretend square box
box: make object! [
size: 10
show: function [] [
print ["Showing size =" size "from within the box!"]
]
]

; Use the encapsulated function
box/show
Showing size = 10 from within the box!
top alphanumeric-index category-index

Red word:    object!    type=datatype!

Categories to which this word belongs: Datatypes

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    object?    type=function!

Categories to which this word belongs: Type Checking

Description
The word object? returns true if its argument is an object!.

The single argument can be of any type.
Examples
; make an object - a pretend square box
red>> box: make object! [
[ size: 10
[ show: function [] [
[ print ["Showing size =" size "from within the box!"]
[ ]
[ ]
== make object! [
size: 10
show: func [][
print ["...

; Is this an object?
red>> object? box
== true

; Definitely not an object
red>> amounts: [2 3 4]
== [2 3 4]

red>> object? amounts
== false
top alphanumeric-index category-index

Red word:    odd?    type=action!

Categories to which this word belongs: Math

Description
The word odd? returns true if its numeric parameter is odd,
else returns false.

Has 1 numeric parameter, which should be an integer!.
Examples
odd? -3
== true

odd? 10
== false
top alphanumeric-index category-index

Red word:    off    type=logic!

Categories to which this word belongs: Boolean

Description
The word off has the logical value "false" 
and its datatype! is logic!

Logical values are produced from various comparisons.

The logic! type also provides:
false, no, on, true, yes
Examples
red>> ? off
off is a logic! of value: false

red>> either off [print "t is true"] [print "t is NOT true"]
t is NOT true
top alphanumeric-index category-index

Red word:    on    type=logic!

Categories to which this word belongs: Boolean, Constants

Description
The word on has the logical value "true" 
and its datatype! is logic!

Logical values are produced from various comparisons.

The logic! type also provides:
false, no, off, true, yes
Examples
red>> ? on
on is a logic! of value: true

red>> either on [print "It is true!"] [print ["It is NOT true!"]]
It is true!
top alphanumeric-index category-index

Red word:    op!    type=datatype!

Categories to which this word belongs: Datatypes

Description
The datatype! op! represents the class of Red functions that
act as infix operators.
Examples
; -------------------------------------------------------------------------
; List all infix operators with type op!
; -------------------------------------------------------------------------
red>> ? op!
% => Returns what is left over when one value is divided by another
* => Returns the product of two values
** => Returns a number raised to a given power (exponent)
+ => Returns the sum of the two values
- => Returns the difference between two values
/ => Returns the quotient of two values
// => Compute a nonnegative remainder of A divided by B
< => Returns TRUE if the first value is less than the second
<<
<= => Returns TRUE if the first value is less than or equal to the second
<> => Returns TRUE if two values are not equal
= => Returns TRUE if two values are equal
== => Returns TRUE if two values are equal, and also the same datatype
=? => Returns TRUE if two values have the same identity
> => Returns TRUE if the first value is greater than the second
>= => Returns TRUE if the first value is greater than or equal to the second
>>
>>>
and => Returns the first value ANDed with the second
is => Defines a local reactive relations inside a reactor
or => Returns the first value ORed with the second
xor => Returns the first value exclusive ORed with the second

; -------------------------------------------------------------------------
; Some examples of infix operations
; -------------------------------------------------------------------------
red>> 1 + 2
== 3

red>> 2 * 5
== 10

red>> 10 / 2
== 5

red>> 10 // 2
== 0

red>> 10 // 3
== 1
top alphanumeric-index category-index

Red word:    op?    type=function!

Categories to which this word belongs: Type Checking

Description
The word op? returns true if its argument is an op! type.  

This type includes infix operators, such as + - * etc).

Note the use of : to prevent evaluation of the argument!
Examples
red>> op? :and
== true

red>> op? :print
== false

red>> op? :+
== true

red>> op? :-
== true

red>> op? :float?
== false
top alphanumeric-index category-index

Red word:    or    type=op!

Categories to which this word belongs: Bit manipulation, Boolean, Comparison, Logic

Description
The infix word or performs a logical "or" of two values.
The values are restricted to these types:
logic! integer! char! bitset! typeset!
pair! tuple! #vector!

It is the infix version of the word or~.

In the case of oring two integer!s (or closely related types,
such as char! and pair!), a bitwise (bit-by-bit) process is performed.

In general, types can be mixed, but logic! types cannot be mixed with other types.

The type of the result is the same type as the first value for a bitwise or.
For a logic! or, true or false are returned.
Examples
red>> (3 > 2) or false
== true

red>> 8 or 16
== 24

red>> 16 or false
*** Script error: logic type is not allowed here
*** Where: or

red>> my-pair: 3x4
== 3x4

red>> my-pair or 1
== 3x5

red>> 1 or my-pair
*** Script error: or does not allow pair for its value2 argument
*** Where: or

red>> v1: make vector![1 2 3]
== make vector! [1 2 3]

red>> v2: make vector![1 1 1]
== make vector! [1 1 1]

red>> v1 or v2
== make vector! [1 3 3]
top alphanumeric-index category-index

Red word:    or~    type=action!

Categories to which this word belongs: Bit manipulation, Boolean, Comparison, Logic

Description
The or~ word performs a logical "or" of its 2 arguments.
The values are restricted to these types:
logic! integer! char! bitset! typeset! pair! tuple! vector!

It is the functional version of the infix word or.

In the case of or~ing two integer!s (or types closely related to integers,
such as char!, pair!), a bitwise (bit-by-bit) process is performed.

In general, types can be mixed, but logic! types cannot be mixed with other types.

The type of the result is the same type as the first value for a bitwise or~.
For a logic or~, true or false are returned.
Examples
red>> or~ (3 > 2) false
== true

red>> or~ 8 16
== 24

red>> or~ 16 false
*** Script error: logic type is not allowed here
*** Where: or~

red>> my-pair: 3x4
== 3x4

red>> or~ my-pair 1
== 3x5

red>> or~ 1 my-pair
*** Script error: or~ does not allow pair for its value2 argument
*** Where: or~

red>> v1: make vector![ 1 2 3]
== make vector! [1 2 3]

red>> v2: make vector![1 1 1]
== make vector! [1 1 1]

red>> or~ v1 v2
== make vector! [1 3 3]
top alphanumeric-index category-index

Red word:    pad    type=function!

Categories to which this word belongs: Formatting, String manipulation

Description
The word pad pads a string! on the right side with spaces.

The arguments are:
1. the string! to pad
2. the total size (integer!) of the new string!.

Refinements:
/left - pads the string! at its left side.
Examples
; Note the 4 (i.e. 6 - 2) spaces between B and X
red>> prin "X" prin pad "AB" 6 print "X" print "-123456-"
XAB X
-123456-

; Note the 4 spaces between the X and A
red>> prin "X" prin pad/left "AB" 6 print "X" print "-123456-"
X ABX
-123456-
top alphanumeric-index category-index

Red word:    pair!    type=datatype!

Categories to which this word belongs: Datatypes

Description
The datatype! pair! represents a scalar! type containing 
2 values.

A pair looks like:
axb

Pairs can be used to represent points in Cartesian space. (Coordinates)

The constituents of a pair! can be retrieved as follows:
- retrieve left value by either pairname/1 or pairname/x
- retrieve right value by either pairname/2 or pairname/y
Examples
; -------------------------------------------------------------------------
; Some examples
; -------------------------------------------------------------------------
red>> coord1: 10x20
== 10x20

red>> coord2: 100x100
== 100x100

red>> coord1 + coord2
== 110x120

red>> coord1 * coord2
== 1000x2000

red>> coord1/x
== 10

red>> coord1/1
== 10

red>> coord2/y: 234
== 234

red>> coord2
== 100x234
top alphanumeric-index category-index

Red word:    pair?    type=function!

Categories to which this word belongs: Type Checking

Description
The word pair? returns true if its argument is of datatype! pair!.

The argument can be of any type.
; Integer
red>> pair? 123
== false

; Tuple
red>> pair? 1.2.33
== false

; Pair
red>> pair? 22x33
== true

; Result of adding 2 pairs
red>> pair? 22x33 + 1x1
== true

top alphanumeric-index category-index

Red word:    paren!    type=datatype!

Categories to which this word belongs: Datatypes

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    paren?    type=function!

Categories to which this word belongs: Type Checking

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    parse    type=native!

Categories to which this word belongs: Parse

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    parse-trace    type=function!

Categories to which this word belongs: Parse

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    path!    type=datatype!

Categories to which this word belongs: Datatypes, Objects, Series, URL

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    path?    type=function!

Categories to which this word belongs: Files, Objects, Series, Type Checking, URL

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    percent!    type=datatype!

Categories to which this word belongs: Datatypes

Description
The datatype! percent! represents a number! type containing 
32 bit whole signed numbers.
Examples
; -------------------------------------------------------------------------
; Some examples
; -------------------------------------------------------------------------
red>> 35 * 10%
== 3.5

red>> 35 * (10.0 / 100) ; Exactly the same
== 3.5

red>> 100% / 40% ; Not so useful?
== 250%
top alphanumeric-index category-index

Red word:    percent?    type=function!

Categories to which this word belongs: Type Checking

Description
The word percent? returns true if its argument is a percent! type, 
otherwise false.

The argument can be any type.
Examples
red>> x: 100%
== 100%

red>> percent? x
== true

red>> y: 200
== 200

red>> percent? y
== false
top alphanumeric-index category-index

Red word:    pi    type=float!

Categories to which this word belongs: Constants, Math

Description
The word pi is a mathematical constant.

It can be roughly approached by dividing 22 by 7.
Examples
red>> ? pi
pi is a float! of value: 3.141592653589793

red>> 22.0 / 7
== 3.142857142857143
top alphanumeric-index category-index

Red word:    pick    type=action!

Categories to which this word belongs: Series, String manipulation

Description
The word pick takes the nth value of a series!, where n is the second argument
Examples
; -------------------------------------------------------------------------
; Using a block! of numbers
; -------------------------------------------------------------------------
red>> x: [1 2 3 4 5 6 7 8]
== [1 2 3 4 5 6 7 8]

red>> y: pick x 4
== 4

red>> x
== [1 2 3 4 5 6 7 8]

red>> y
== 4

; -------------------------------------------------------------------------
; Using a string!
; -------------------------------------------------------------------------
red>> s: "abcdefghijklmnopqrstuvwxyz"
== "abcdefghijklmnopqrstuvwxyz"

red>> pick s 1
== #"a"

red>> pick s 26
== #"z"

red>> pick s 27
== none ; Index out of range

; -------------------------------------------------------------------------
; Using a block! of string!s
; -------------------------------------------------------------------------
red>> p: ["abc" "def" "ghi" "jkl" "mno" "pqr" "stu"]
== ["abc" "def" "ghi" "jkl" "mno" "pqr" "stu"]

red>> pick p 1
== "abc"

red>> pick p 4
== "jkl"

red>> pick p -1
== none ; Index out of range
top alphanumeric-index category-index

Red word:    point    type=unset!

Categories to which this word belongs: Type Checking

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    point!    type=datatype!

Categories to which this word belongs: Datatypes

Description
The datatype! point! represents points in the Cartesian coordinate
system. A point on the X-Y-axis.
Examples
; -------------------------------------------------------------------------
; Some examples
; -------------------------------------------------------------------------
red>> p: 100x100
== 100x100

red>> q: 2
== 2

red>> p * q
== 200x200

red>> x: 10x10
== 10x10

red>> y: 2x3
== 2x3

red>> x * y
== 20x30
top alphanumeric-index category-index

Red word:    poke    type=action!

Categories to which this word belongs: Series, String manipulation

Description
The word poke changes an element of a series! to a value.

Arguments:
- name of the series!
- the index of the element to be replaced
- the new value for that element
Examples
; -------------------------------------------------------------------------
; Using a block! of numbers
; -------------------------------------------------------------------------
red>> x: [1 2 3 4 5 6 7 8 9]
== [1 2 3 4 5 6 7 8 9]

red>> poke x 3 66
== 66

red>> x
== [1 2 66 4 5 6 7 8 9]

red>> poke x 11 12
*** Script Error: value out of range: 11
*** Where: poke

; -------------------------------------------------------------------------
; using a string!
; -------------------------------------------------------------------------
red>> s: "abcdefghijklmnop"
== "abcdefghijklmnop"

red>> poke s 3 #"C"
== #"C"

red>> s
== "abCdefghijklmnop"
top alphanumeric-index category-index

Red word:    positive?    type=native!

Categories to which this word belongs: Comparison

Description
The word positive? returns true if the numeric parameter 
is greater than 0, otherwise false.

NOTE that zero returns false.

Has one numeric parameter.
Examples
positive? -2
== false

positive? 0
== false

positive? 0.1
== true
top alphanumeric-index category-index

Red word:    power    type=action!

Categories to which this word belongs: Math

Description
The word power returns the value of a number! raised to a given power (exponent).

It is the functional version of the infix word **.

It has 2 arguments: a base value and a power, both number!s.
Examples
red>> power 3.1 2
== 9.61

red>> power 100.9 0.5
== 10.04489920307815

red>> power 2 10
== 1024
top alphanumeric-index category-index

Red word:    prin    type=native!

Categories to which this word belongs: Console, Output

Description
The word prin outputs a value to the Red console in a similar manner to 
the print word, but without emitting an end-of-line: "^(line)".

For more details, look at print.
Examples
red>> prin 3 + 3  prin 4 + 4 print "done"
68done
top alphanumeric-index category-index

Red word:    print    type=native!

Categories to which this word belongs: Console, Output

Description
The word print outputs its argument to the Red console, followed by a 
new-line: "^(line)".

The single argument can be any type (also a block!).

The twin word prin does the same but without outputting new-line.
Examples
red>> area: 3 * 2
== 6

red>> print area
6

red>> print area * 10
60

red>> print "Hello"
Hello

; Block is useful for printing several items
; Note: print will insert a space between the items in the block!
red>> print ["Area is" area "square units"]
Area is 6 square units
top alphanumeric-index category-index

Red word:    probe    type=function!

Categories to which this word belongs: Console

Description
The word probe returns its argument, after printing it in its molded form.

Its argument can be of any type.

Have a look at mold for specifics on the formatting.
Examples
; Behavior of print
red>> print [1 2 3]
1 2 3

; Behavior of mold
red>> probe [1 2 3]
[1 2 3]
== [1 2 3]

; Note the molded form
red>> probe #"A"
#"A"
== #"A"

; Same but now printed
red>> print probe #"A"
#"A"
A
top alphanumeric-index category-index

Red word:    put    type=action!

Categories to which this word belongs: Maps

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    pwd    type=function!

Categories to which this word belongs: Directories

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    q    type=function!

This word is a synonym for quit
top alphanumeric-index category-index

Red word:    quit    type=function!

Categories to which this word belongs: Exiting, System Related

Description
The word quit quits the interpreter (and thus the program) immediately.

Refinement:
/return p - When this refinement is used value p is returned by quit.
Examples
quit
; returns immediately to the OS command prompt

quit/return 3
; returns to the OS command prompt and hands the OS the value 3
top alphanumeric-index category-index

Red word:    quit-return    type=routine!

Categories to which this word belongs: Exiting, System Related

Description
The word quit-return stops evaluation and exits the program 
with a given return code.

The argument is the return code, an integer!.
Examples
data: 1234
either data > 0
[quit-return 1]
[quit-return 0]
; This program returns 1 to the OS. This is the program's return code.
; Ways of handling this depend on the particular OS.
top alphanumeric-index category-index

Red word:    quote    type=function!

Categories to which this word belongs: Word Manipulation

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    random    type=action!

Categories to which this word belongs: Math

Description
The word random returns a random value of the same type as its single argument.
For certain types and refinements, it can shuffle or pick from a series!.

For an integer! argument of value n, the random value is between 1 and n inclusive.

Refinements
/seed - Restart or randomize
/secure - Returns a cryptographically secure random number!
/only - Pick a random value from a series!
Examples
red>> random 2
== 1

red>> random 2
== 2

red>> random 1.0
== 0.4107365828988778

red>> random "fish"
== "ifhs"

red>> random/only "abcde"
== #"a"

red>> random [1 2 3 4]
== [2 1 4 3]

red>> random/only ["stone" "paper" "scissors"]
== "scissors"
top alphanumeric-index category-index

Red word:    react?    type=function!

Categories to which this word belongs: Unknown

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    read    type=action!

Categories to which this word belongs: Directories, Files, Input, URL

Description
The word read reads and returns data from a file!.  

The argument must be a file! type.

Refinements:
/binary - reads, and preserves contents exactly
/lines - reads lines of text, placing them in a block! of string!s.
/info -
/part
/as
/seek
Examples
; The following example was executed on Windows, using a text file created with
; Notepad, and placed in the same folder as the program. The file contains 2 lines:

; LINE1
; LINE2

; Inside the file, the end of each line is marked by a CRLF pair.
; However, when Red reads the data as text, it presents the data to us with only
; the LF character at the end, just as on Linux.

; 1) read a file as strings

text: read %read-data.txt

print length? text ; 12 characters
12

prin text ; Displays all the lines. No extra newline
LINE1
LINE2

; 2) read a file as binary

bin: read/binary %read-data.txt

print length? bin ; 14 bytes
14

print bin ; In hex format
#{4C494E45310D0A4C494E45320D0A}

; 3) read individual lines (strings)

text: read/lines %read-data.txt

print length? pick text 1 ; Length is 5 - no LF
5

print pick text 2 ; Print second line
LINE
top alphanumeric-index category-index

Red word:    red-complete-file    type=function!

Categories to which this word belongs: Directories, Files

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    red-complete-path    type=function!

Categories to which this word belongs: Directories, Files

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    reduce    type=native!

Categories to which this word belongs: Evaluation

Description
The word reduce returns a copy of a block!, evaluating all expressions
in the block!.

Its single argument can be of any type.

Refinements
/into - puts results into a provided block!, instead of creating a new one.

Examples
red>> reduce[1 + 2 5 * 6]
[3 30]

red>> b: reduce[1 + 5]
[6]

red>> b
[6]

; -------------------------------------------------------------------------
; Use the /into refinement
; -------------------------------------------------------------------------

red>> a-block: []
[]

red>> reduce/into [4 5 + 6] a-block
[]

red>> a-block
[4 11]

; -------------------------------------------------------------------------
; Evaluating can also mean assignment
; -------------------------------------------------------------------------

red>> var: 3
3

red>> reduce [ 3 * 3 var: 22]
[9 22]

red>> var
22

; -------------------------------------------------------------------------
; Single values, variables or expressions (not in a block)
; -------------------------------------------------------------------------

red>> reduce 123
123

red>> reduce 1 + 2
3
top alphanumeric-index category-index

Red word:    refinement!    type=datatype!

Categories to which this word belongs: Datatypes

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    refinement?    type=function!

Categories to which this word belongs: Type Checking

Description
The refinement? word returns true if the single argument is a 
refinement, otherwise false.

Note that the argument is not checked against all existing refinements,
merely that it fits the syntax for a refinement.

The single argument can be of any type.
Examples
red>> refinement? /all
true

red>> refinement? /nonsense
true

red>> refinement? /123
true

; -------------------------------------------------------------------------
; Invalid: string is not a refinement
; -------------------------------------------------------------------------

red>> refinement? "/abc"
false

red>> r: "/abc"
"/abc"

red>> refinement? r
false

; -------------------------------------------------------------------------
; Valid: a refinement can be stored in a variable
; -------------------------------------------------------------------------

red>> r: /abc
== /abc

red>> refinement? r
== true
top alphanumeric-index category-index

Red word:    reflect    type=action!

Categories to which this word belongs: Reflection

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    remainder    type=action!

Categories to which this word belongs: Math

Description
The word remainder returns the rest of dividing the first by the second value.

Has 2 arguments of type:
number! char! pair! tuple! vector!

It is the functional version of the infix word //.

If the first argument is positive, then the remainder is positive.

If the first argument is negative, then the remainder is negative,
as in remainder -5 4, which results in -1.

If the first argument is zero, then the remainder is also zero.

If the second argument is zero, a run-time error occurs.
Examples
red>> remainder 5 4
== 1

red>> remainder 5 5
== 0

red>> remainder 5 6
== 5
; 5 divided by 6 gives zero
; with remainder of 5

red>> remainder -5 4
== -1

red>> remainder 10 3.3
== 0.1000000000000005

red>> remainder 5x10 4
== 1x2

red>> remainder make vector![5 5 10] 4
== make vector! [1 1 2]
top alphanumeric-index category-index

Red word:    remove    type=action!

Categories to which this word belongs: Series, String manipulation

Description
The word remove removes the first value(s) from a series!
and returns the modified series! from the removal point onwards.

The single argument can be of type:
series!
bitset!
none!

Refinements
/part - removes a number of values, or values up to the
given index.
This refinement requires one of:
number!
char!
series!

Note that for a bitset! argument, the /part refinement is required.

Note that remove is destructive. It changes the series! involved!!
Examples
; -------------------------------------------------------------------------
; Setup 2 variables to be used in the examples
; -------------------------------------------------------------------------
red>> data: [22 11 44 66 10]
== [22 11 44 66 10]

red>> s: "abcdefg"
== "abcdefg"

; -------------------------------------------------------------------------
; Remove first item of a series!
; -------------------------------------------------------------------------
red>> remove data
== [11 44 66 10]

red>> data
== [11 44 66 10]

; -------------------------------------------------------------------------
; Remove first item of a string!
; -------------------------------------------------------------------------
red>> remove s
== "bcdefg"

red>> s
== "bcdefg"

; -------------------------------------------------------------------------
; Remove the first 2 items using /part
; -------------------------------------------------------------------------
red>> remove/part data 2
== [66 10]

red>> data
== [66 10]

red>> remove/part s 2
== "defg"

red>> s
== "defg"

; -------------------------------------------------------------------------
; Bitset (E.g. hex code for "A" is 65, so the 65th bit is set)
; -------------------------------------------------------------------------
red>> b: make bitset![#"A" #"N"]
make bitset! #{00000000000000004002}

red>> remove/part b #"N"
make bitset! #{00000000000000004000}

; -------------------------------------------------------------------------
; Use /part with a series! index
; -------------------------------------------------------------------------
red>> nums: [1 2 3 4 5 6 7 8]
== [1 2 3 4 5 6 7 8]

red>> ref: skip nums 4
== [5 6 7 8]

red>> remove/part nums ref
== [5 6 7 8]

red>> nums
== [5 6 7 8]

red>> ref
== []
top alphanumeric-index category-index

Red word:    remove-each    type=native!

Categories to which this word belongs: Unknown

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    repeat    type=native!

Categories to which this word belongs: Iteration

Description
The word repeat evaluates a given block! a specified number of times 
and exposes the count value to the block! being executed.

Has 3 parameters:
1. name of a count variable, which contains the current value of the counter
2. number of times the block! should be evaluated
3. the block! to be evaluated

Warning:
1. the count variable can only be referred within the block!;
so, if before the repeat a variable exists with the same name,
that variable will be untouched after repeat
2. when repeat introduces a unique name for count, that name
cannot be referenced anymore after repeat
Examples
counter: 33
== 33
repeat counter 4 [print ["Evaluation #" counter]]
Evaluation # 1
Evaluation # 2
Evaluation # 3
Evaluation # 4
>> counter
== 33

repeat x 3 [print ["Evaluation #" x]]
Evaluation # 1
Evaluation # 2
Evaluation # 3
>> x
** Script Error: x has no value
** Near: x

repeat y 5 [y: y - 1 print ["y =" y]]
y = 0
y = 1
y = 2
y = 3
y = 4
top alphanumeric-index category-index

Red word:    repend    type=function!

Categories to which this word belongs: Unknown

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    replace    type=function!

Categories to which this word belongs: Series, String manipulation

Description
The word replace replaces the search-value with the replace value 
in a series!.

It can be used with strings, because a string! is a series!.

It has 3 arguments:
series - the series! to be modified.
search-value - the value to be replaced (any type)
replace-value - the value to replace with (any type)

The search is case-insensitive and only the first occurrence is replaced,
unless the refinement /all is used.

The replaced and replacing item can have a different length.

Refinements
/all - replace all occurrences

Note that this is a destructive operation. It alters the series!
involved!
Examples
; -------------------------------------------------------------------------
; Replace a by W
; -------------------------------------------------------------------------

red>> s: "abcde"
"abcde"

red>> replace s "a" "W"
"Wbcde"

red>> s
"Wbcde"

; -------------------------------------------------------------------------
; Note the case insensitivity here
; -------------------------------------------------------------------------

red>> a-string: "The cat and the dog"
"The cat and the dog"

red>> replace a-string "the" "a"
"a cat and the dog"

; -------------------------------------------------------------------------
; Using the /all refinement
; -------------------------------------------------------------------------

red>> river: "Mississippi"
"Mississippi"

red>> replace/all river "is" "IS"
"MISsISsippi"

; -------------------------------------------------------------------------
; A series of numbers
; -------------------------------------------------------------------------

red>> nums: [21 22 23 -1 44 45 46]
[21 22 23 -1 44 45 46]

red>> replace nums -1 [33 34 35]
[21 22 23 33 34 35 44 45 46]

red>> replace nums [21 22 23] -1
[-1 33 34 35 44 45 46]
top alphanumeric-index category-index

Red word:    request-dir    type=native!

Categories to which this word belongs: Directories, Files

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    request-file    type=native!

Categories to which this word belongs: Directories, Files

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    request-font    type=function!

Categories to which this word belongs: Unknown

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    return    type=native!

Categories to which this word belongs: Exiting

Description
The word return returns a value from a function. 
It needs one argument, of any type.

In functions which don't have a return value, you can use the word exit.

Under special conditions it is useful to return the value none.

The value of a block! is the value of last evaluation that takes place in it,
so this can be used to return a value, without using the return word.

If we want to return a value partway through a block!, or want to make it
more explicit for a reader of the code, we also can use return.
Examples
bigger: func [a b] [
either a > b [
return a
][
return b
]
]
print bigger 8 6
8
top alphanumeric-index category-index

Red word:    reverse    type=action!

Categories to which this word belongs: Series, String manipulation

Description
The word reverse reverses the order of elements in its argument.  
The argument will be changed. Returns at the same position in the argument.

The argument can be a:
series!
pair!
tuple!

Refinements
/part - limits to a given length or position (number! series!)

Note:
- for series! reverse is destructive
- but not for tuple! and pair!
Examples
; -------------------------------------------------------------------------
; Reverse a block! series!
; -------------------------------------------------------------------------
red>> b: [1 2 3 4]
== [1 2 3 4]

red>> reverse b
== [4 3 2 1]

red>> b
== [4 3 2 1]

red>> s: "ABCD"
== "ABCD"

red>> reverse s
== "DCBA"

red>> s
== "DCBA"

; -------------------------------------------------------------------------
; Reverse a section of a string! series!
; -------------------------------------------------------------------------
red>> words: "The black cat"
== "The black cat"

red>> reverse find words "cat"
== "tac"

red>> words
== "The black tac"

; -------------------------------------------------------------------------
; Use refinement /part - reverse first 3
; -------------------------------------------------------------------------
red>> s: "abcdefg"
== "abcdefg"

red>> reverse/part s 3
== "cbadefg"

red>> s
== "cbadefg"

; -------------------------------------------------------------------------
; Reverse all values before value 50
; -------------------------------------------------------------------------
red>> b: [10 20 30 40 50 60 70]
== [10 20 30 40 50 60 70]

red>> reverse/part b find b 50
== [40 30 20 10 50 60 70]

red>> b
== [40 30 20 10 50 60 70]

; -------------------------------------------------------------------------
; Reverse a tuple - note unchanged value of t afterwards!
; -------------------------------------------------------------------------
red>> t: 11.22.33.44.55
== 11.22.33.44.55

red>> reverse t
== 55.44.33.22.11

red>> t
== 11.22.33.44.55

; -------------------------------------------------------------------------
; Reverse a pair - note unchanged value of p afterwards!
; -------------------------------------------------------------------------
red>> p: 100x200
== 100x200

red>> reverse p
== 200x100

red>> p
== 100x200
top alphanumeric-index category-index

Red word:    round    type=action!

Categories to which this word belongs: Math

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    routine    type=function!

Categories to which this word belongs: Functions, Unknown

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    routine!    type=datatype!

Categories to which this word belongs: Datatypes, Functions

Description
The datatype! routine! is used to link up to external code.  

Once a library has been loaded, it is possible to create a routine!
type to access the external function from Red.

You can use make to create a new, named routine!.
Examples
; -------------------------------------------------------------------------
; Use make to create a routine!
; -------------------------------------------------------------------------

; red-routine-name: make routine! specs library-name func-id

; -------------------------------------------------------------------------
; Docs to be extended by red-by-example team ...
; -------------------------------------------------------------------------


top alphanumeric-index category-index

Red word:    routine?    type=function!

Categories to which this word belongs: Functions, Type Checking

Description
The word routine? returns true if its argument is a routine!,
otherwise false.

A routine! is a function in an external library.

Its single argument can be of any type.
Examples
; -------------------------------------------------------------------------
; The word cos is external
; -------------------------------------------------------------------------
red>> routine? :cos ; Note the colon!
true

; -------------------------------------------------------------------------
; The word sort is not in an external library
; -------------------------------------------------------------------------
red>> routine? :sort
false

top alphanumeric-index category-index

Red word:    same?    type=native!

Categories to which this word belongs: Comparison, Type Checking

Description
The word same? returns true if the arguments refer to 
identical objects, otherwise false.

For example, true would be returned if two strings are the
same string (that is: they occupy the same memory location).

The two arguments can be of any type.
Examples
; -------------------------------------------------------------------------
; Same string, but in differnet memory locations
; -------------------------------------------------------------------------
red>> a: "fish"
"fish"

red>> b: "fish"
"fish"

red>> same? a b
false

; -------------------------------------------------------------------------
; Same string and same memory location
; -------------------------------------------------------------------------
red>> a: "meat"
"meat"

red>> b: a
"meat"

red>> same? a b
true
top alphanumeric-index category-index

Red word:    save    type=function!

Categories to which this word belongs: Files

Description
The word save is used to save Red code to a file!, url!, 
binary! or string!.

The load word is intended for reading back items created with save.
Note that write is intended for storing data, not code.

Red uses brackets [ ] { } and quotes " " etc. to enclose data items.
The items might or might not be code. In a sense they become code when
we instruct Red to interpret them. Because of this, save can be
used to save data as well as code. In fact, there is no difference.
Red has the same adagium as Lisp: ; Code = Data.

The word save has 2 arguments:
where to save - one of
file! url! binary! string! none!
value - the value(s) to save

Refinements:
/header - provide a Red header block (or output non-code datatypes).
This requires header-data (a block!) or an object!
/all - save in serialized format. (Not available yet)
/length - save the length of the script content in the header
/as - specify the format of data; use NONE to save as plain text;
format [word! none!] => E.g. json, html, jpeg, png, redbin etc.
Examples
; -------------------------------------------------------------------------
; Save 2 lines of code in a file mydata.r
; -------------------------------------------------------------------------
red>> code: [
[ print "Hello"
[ print "Goodbye"
[ ]
== [
print "Hello"
print "Goodbye"
]

red>> save %mydata.r code

; -------------------------------------------------------------------------
; Load the just saved data back
; -------------------------------------------------------------------------
red>> load %mydata.r
[print "Hello"
print "Goodbye"
]

; -------------------------------------------------------------------------
; We can use do to interpret the code in the file
; -------------------------------------------------------------------------
red>> do %mydata.r
Hello
Goodbye

red>> do code
Hello
Goodbye

; -------------------------------------------------------------------------
; Save some structured data
; -------------------------------------------------------------------------
red>> data: [ [1 10] [2 20] 30]
== [[1 10] [2 20] 30]

red>> save %mydata.r data

; -------------------------------------------------------------------------
; Load that data back
; -------------------------------------------------------------------------
red>> load %mydata.r
== [[1 10] [2 20] 30]

top alphanumeric-index category-index

Red word:    second    type=function!

Categories to which this word belongs: Series, String manipulation

Description
The word second returns the second value of a series!. 

The argument can be one of:
series! tuple! pair!

If there is no second item in the series!, none is returned.
Examples
; -------------------------------------------------------------------------
; Second of a block!
; -------------------------------------------------------------------------
red>> second [3 4 5]
4

; -------------------------------------------------------------------------
; Second of a string! (a char!)
; -------------------------------------------------------------------------
red>> second "ABC"
#"B"

; -------------------------------------------------------------------------
; A series! having no second element
; -------------------------------------------------------------------------
red>> second [44]
none

; -------------------------------------------------------------------------
; Second of a tuple!
; -------------------------------------------------------------------------
red>> second 66.77.88
77

; -------------------------------------------------------------------------
; Second of a pair!
; -------------------------------------------------------------------------
red>> second 22x55
55
top alphanumeric-index category-index

Red word:    select    type=action!

Categories to which this word belongs: Series, String manipulation

Description
The word select finds a value in a series! and if succesful returns 
the element right after the element found. Returns none if the search fails.

Select is similar to the find function.

The 2 arguments are:
a series - of type series! any-object! map! none!
a value - of any type

Refinements
/part - Limit the length (a number!) of the search or a series! reference.
/only - Treat a series search value as a single value.
/case - Perform a case-sensitive search.
/any - Use * and ? wildcards in string searches.
/with - Use custom wildcards * or ?.
/skip - Treat the series as fixed size records. Requires an integer! size.
/last - Find the last occurrence of value (from the tail).
/reverse - Find the last occurrence of value (from the current index).

Examples
; -------------------------------------------------------------------------
; Select a month, return item following it
; -------------------------------------------------------------------------
red>> months: ["Mar" 31 "April" 30 "May" 31]
== ["Mar" 31 "April" 30 "May" 31]

red>> select Months "April"
== 30

red>> select Months 30
== "May" ; Beware that select can match any element!

; -------------------------------------------------------------------------
; Select a character in a string! (after D)
; -------------------------------------------------------------------------
red>> str: "ABCDEFGH"
== "ABCDEFGH"

red>> select str "D"
== #"E" ; Because E follows the found element D

; -------------------------------------------------------------------------
; /pairs - do a normal select, then use /pairs
; -------------------------------------------------------------------------
red>> pairs: [44 4 3 33 4 55]
== [44 4 3 33 4 55]

red>> select pairs 4
== 3 ; Because 3 follows the found element 4

; -------------------------------------------------------------------------
; Select only matches the first element in a skip group
; -------------------------------------------------------------------------
red>> select/skip pairs 4 2
== 55

; -------------------------------------------------------------------------
; Search form the tail
; -------------------------------------------------------------------------
red>> animal: "The black cat"
== "The black cat"

red>> select/last animal "a"
== #"t"

; -------------------------------------------------------------------------
; Using the /only refinement
; -------------------------------------------------------------------------
red>> blk: [11 12 13 [22 33 44] 15]
== [11 12 13 [22 33 44] 15]

red>> select blk 13
== [22 33 44]

red>> select blk [22 33 44]
== none ; Not found, because we searched for a series!

red>> select/only blk [22 33 44]
15

red>> select/only blk [22 33 44]
== 15 ; Success! With /only we can search for a series!

; -------------------------------------------------------------------------
; Search backwards from a position with the /reverse refinement
; -------------------------------------------------------------------------
red>> words: "a-few-words"
== "a-few-words"

red>> current: find/last words "-"
"-words"

red>> current: find/last words "-"
== "-words"

red>> index? current
== 6

red>> select/reverse current "-"
== #"f"
top alphanumeric-index category-index

Red word:    series!    type=typeset!

Categories to which this word belongs: Datatypes

Description
The datatype! series! is a typeset! containing several datatype!s.
Examples
; -------------------------------------------------------------------------
; Show all series! types
; -------------------------------------------------------------------------
red>> ? series!
series! is a typeset! of value:
make typeset! [
block!
paren!
string!
file!
url!
path!
lit-path!
set-path!
get-path!
vector!
hash!
binary!
image!
]
top alphanumeric-index category-index

Red word:    series?    type=function!

Categories to which this word belongs: Type Checking

Description
word series? returns true if its argument is a
series!, otherwise false.

The argument can be of any type.

The series! type includes:
block!
paren!
string!
file!
url!
path!
lit-path!
set-path!
get-path!
vector!
hash!
binary!
image!
Examples
; -------------------------------------------------------------------------
; A block!
; -------------------------------------------------------------------------
red>> series? [1 "text"]
true

; -------------------------------------------------------------------------
; A tuple!
; -------------------------------------------------------------------------
red>> series? 12.33.12
false

; -------------------------------------------------------------------------
; A string!
; -------------------------------------------------------------------------
red>> series? "ABC"
true

; -------------------------------------------------------------------------
; A float!
; -------------------------------------------------------------------------
red>> series? 12.34
false
top alphanumeric-index category-index

Red word:    set    type=native!

Categories to which this word belongs: Word Manipulation

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    set-current-dir    type=routine!

Categories to which this word belongs: Files

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    set-env    type=native!

Categories to which this word belongs: Unknown

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    set-path!    type=datatype!

Categories to which this word belongs: Datatypes

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    set-path?    type=function!

Categories to which this word belongs: Type Checking

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    set-quiet    type=routine!

Categories to which this word belongs: Unknown

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    set-word!    type=datatype!

Categories to which this word belongs: Datatypes

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    set-word?    type=function!

Categories to which this word belongs: Type Checking

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    shift    type=native!

Categories to which this word belongs: Bit manipulation

Description
The word shift performs an arithmetical bit shift operation, 
preserving the sign.

By default it shifts to the right, but left shifting is also possible.

A single right shift divides by 2.
A single left shift multiplies by 2.

Also logical shifting is possible.

It has 2 arguments:
- an integer! to be shifted
- an integer! stating how many places to shift

Note: the infix << >> >>> operators provide similar facilities.

Refinements
/left - shift bits to the left instead of to the right
/logical - use logical shift (unsigned, fill with zeroes)
Examples
; -------------------------------------------------------------------------
; Right-shift a positive number
; -------------------------------------------------------------------------
red>> shift 64 2
== 16

red>> to-hex 64
== #00000040

red>> to-hex 16
== #00000010

; -------------------------------------------------------------------------
; Right-shift a negative number, preserving sign
; -------------------------------------------------------------------------
red>> shift -1 4
== -1

red>> to-hex -1
== #FFFFFFFF ; Left most bit stays 1 (= negative)

; -------------------------------------------------------------------------
; Left-shift a positive number
; -------------------------------------------------------------------------
red>> shift/left 64 2
== 256

red>> to-hex 64
== #00000040

red>> to-hex 256
== #00000100

; -------------------------------------------------------------------------
; Left-shift a negative number, preserving sign
; -------------------------------------------------------------------------
red>> shift/left -1 4
== -16

red>> to-hex -1
== #FFFFFFFF

red>> to-hex -16
== #FFFFFFF0

; -------------------------------------------------------------------------
; Logical right-shift, no sign preservation
; -------------------------------------------------------------------------
red>> shift/logical -1 4
== 268435455

red>> to-hex -1
== #FFFFFFFF

red>> to-hex 268435455
== #0FFFFFFF
top alphanumeric-index category-index

Red word:    shift-left    type=routine!

Categories to which this word belongs: Bit manipulation

Description
The word shift-left performs a logical shift-left operation.  
The sign-bit is not preserved.

A single shift-left multiplies by 2.

It has 2 arguments:
- an integer! value to be shifted
- an integer! stating how many places to shift.

Note that the infix words << >> >>> provide similar
facilities.
Examples
; -------------------------------------------------------------------------
; Normal shift-left
; -------------------------------------------------------------------------
red>> to-hex 64
== #00000040

red>> shift-left 64 2
256

red>> to-hex shift-left 64 2
== #00000100

; -------------------------------------------------------------------------
; Sign bit changed by shift ...
; -------------------------------------------------------------------------
red>> to-hex 1
== #00000001

red>> to-hex shift-left 1 31
== #80000000 ; Left most bit (sign bit) changed

red>> shift-left 1 31
== -2147483648 ; See, it it negative!

red>> to-hex shift-left 1 32
== #00000001 ; Wrapped around by 32 bits now
top alphanumeric-index category-index

Red word:    shift-logical    type=routine!

Categories to which this word belongs: Bit manipulation

Description
The word shift-logical performs a logical right shift. 
The sign is not preserved.

It has 2 arguments:
- an integer! value to be shifted
- an integer! stating how many bitss to shift

Note that the infix << >> >>> operators provide similar facilities.
Examples
; -------------------------------------------------------------------------
; Shift (right) by 2 bits
; -------------------------------------------------------------------------
red>> to-hex 64
== #00000040 ; Last byte = binary 0100 0000

red>> shift-logical 64 2
== 16

red>> to-hex shift-logical 64 2
== #00000010 ; Last byte = binary 0001 0000

; -------------------------------------------------------------------------
; Shift (right) by 1 bit - note zero entering at the left
; -------------------------------------------------------------------------
red>> to-hex -1
== #FFFFFFFF ; First byte = binary 1111 1111

red>> shift-logical -1 1
== 2147483647

red>> to-hex shift-logical -1 1
== #7FFFFFFF ; First byte = binary 0111 1111
top alphanumeric-index category-index

Red word:    shift-right    type=routine!

Categories to which this word belongs: Bit manipulation

Description
The word shift-right performs a right-shift operation.

A single shift-right divides by 2.

It has 2 arguments:
- an integer! value to be shifted
- an integer! stating how many places to shift

Note that the infix << >> >>> operators provide
similar facilities.
Examples
; -------------------------------------------------------------------------
; Normal shift
; -------------------------------------------------------------------------
red>> shift-right 16 2
== 4

; -------------------------------------------------------------------------
; Negative sign (left most bit) will be preserved
; -------------------------------------------------------------------------
to-hex -2147483648
== #80000000 ; #80 is binary 1000 0000

red>> shift-right -2147483648 1
== -1073741824

red>> to-hex -1073741824
== #C0000000 ; #C0 is binary 1100 0000


top alphanumeric-index category-index

Red word:    sin    type=routine!

This word is a synonym for sine
top alphanumeric-index category-index

Red word:    sine    type=native!

Categories to which this word belongs: Math

Description
The word sine returns the trigonometric sine.

Has 1 parameter, a number! (representing an angle).

Refinements:
/radians : expects the input angle in radians;
without refinement expects the input angle in degrees.
Examples
sine 90
== 1.0

sine/radians pi
== 0.0

sine/radians pi + 0.003
== -0.002999995500002016
top alphanumeric-index category-index

Red word:    skip    type=action!

Categories to which this word belongs: Series, String manipulation

Description
The word skip moves the index of a series!.

Note: you can test the position of the index using index?.
Examples
red>> x: [1 2 3 4 5 6 7 8 9]
== [1 2 3 4 5 6 7 8 9]

red>> index? x
== 1

red>> skip x 3
== [4 5 6 7 8 9] ; Skip does not change the target series!

red>> x
== [1 2 3 4 5 6 7 8 9]

red>> x: skip x 3
== [4 5 6 7 8 9]

red>> x
== [4 5 6 7 8 9]

red>> index? x
== 4 ; Original position (1) + skip offset (3)

red>> x: skip x -1 ; Skipping backward is allowed
== [3 4 5 6 7 8 9]

red>> x
== [3 4 5 6 7 8 9]

red>> index? x
== 3

red>> x: skip x 100 ; Skip forward out of range moves to tail
== []

red>> index? x
== 10

red>> tail? x
== true

red>> x: skip x -100 ; Skip backward out of range moves to head
== [1 2 3 4 5 6 7 8 9]

red>> index? x
== 1

red>> head? x
== true
top alphanumeric-index category-index

Red word:    sort    type=action!

Categories to which this word belongs: Series, String manipulation

Description
The word sort sorts a series!, modifying the original series!.  

The default order is ascending and the sort is by default case-insensitive.

The argument must be a series! type:
- block!
- string!
- vector!
etc.

Refinements
/case - perform a case-sensitive sort.
/reverse - reverse the sort order (descending instead of ascending)
/skip - treat the series! as fixed size records (groups of items).
Sorting is performed based on the value of the first item in
a group of items. The group size is specified as an integer!.
/part - sort only part of a series!.
We provide a length (a number!) or a position in the series!
/compare - we specify a comparator, which can be an offset integer!,
a block! or a function!.
/all - will force a group of items to be passed as a series! to
the compare function. You also will need /skip to specify the
size of such a group.
/stable - sort uses Quicksort as its default sorting algorithm.
Quicksort is very fast, but it is an unstable algorithm.
If you need stable sorting, add the /stable refinement, and it
will then use the Merge algorithm instead.
This issue is not significant for sorting simple series!.

Read more about sort algorithms here:
Wikipedia on sort algorithm
Examples
; -------------------------------------------------------------------------
; Sort some numbers ascending (changing the series! involved)
; -------------------------------------------------------------------------
red>> ages: [55 33 73 73 19]
== [55 33 73 73 19]

red>> sort ages
== [19 33 55 73 73]

red>> ages
== [19 33 55 73 73]

; -------------------------------------------------------------------------
; Sort some numbers descending
; -------------------------------------------------------------------------
red>> ages: [55 33 73 73 19]
== [55 33 73 73 19]

red>> sort/reverse ages
== [73 73 55 33 19]

red>> ages
== [73 73 55 33 19]

; -------------------------------------------------------------------------
; Sort strings (case-insensitive sort)
; -------------------------------------------------------------------------
red>> names: ["dog" "Ape" "Cat" "ant" "aardvark"]
== ["dog" "Ape" "Cat" "ant" "aardvark"]

red>> sort names
== ["aardvark" "ant" "Ape" "Cat" "dog"]

red>> names
== ["aardvark" "ant" "Ape" "Cat" "dog"]

; -------------------------------------------------------------------------
; Sort strings (case-insensitive sort)
; -------------------------------------------------------------------------
red>> names: ["dog" "Ape" "Cat" "ant" "aardvark"]
== ["dog" "Ape" "Cat" "ant" "aardvark"]

red>> sort/case names
== ["Ape" "Cat" "aardvark" "ant" "dog"]

red>> names
== ["Ape" "Cat" "aardvark" "ant" "dog"]

; -------------------------------------------------------------------------
; Sort on the first item of each group of 2 items (the name)
; -------------------------------------------------------------------------
red>> name-ages: ["Larry" 45 "Curly" 50 "Mo" 42]
== ["Larry" 45 "Curly" 50 "Mo" 42]

red>> sort/skip name-ages 2
== ["Curly" 50 "Larry" 45 "Mo" 42]

red>> name-ages
== ["Curly" 50 "Larry" 45 "Mo" 42]

; -------------------------------------------------------------------------
; Sort on a specific item (not the first which is default) of each group
; -------------------------------------------------------------------------
red>> name-ages: ["Larry" 45 "Curly" 50 "Mo" 42]
== ["Larry" 45 "Curly" 50 "Mo" 42]

red>> sort/skip/compare name-ages 2 2
== ["Mo" 42 "Larry" 45 "Curly" 50]

red>> name-ages
== ["Mo" 42 "Larry" 45 "Curly" 50]

; -------------------------------------------------------------------------
; Sort only a subset of the series! using a number
; -------------------------------------------------------------------------
red>> s: [8 7 6 5 4 3 2]
== [8 7 6 5 4 3 2]

red>> sort/part s 3
== [6 7 8 5 4 3 2] ; Only the first 3 items were sorted

red>> s
== [6 7 8 5 4 3 2]

; -------------------------------------------------------------------------
; Sort only a subset of the series! using a position
; -------------------------------------------------------------------------
red>> n: [9 8 7 6 5 4 3 2 1]
== [9 8 7 6 5 4 3 2 1]

red>> pos: skip n 4
== [5 4 3 2 1]

red>> sort/part n pos
== [6 7 8 9 5 4 3 2 1] ; Only the first 4 items were sorted

red>> n
== [6 7 8 9 5 4 3 2 1]

; -------------------------------------------------------------------------
; Using /compare to specify a function to compare 2 items
; -------------------------------------------------------------------------
red>> names: ["Larry" "Curly" "Mo" ]
== ["Larry" "Curly" "Mo"]

red>> sort/compare names function [a b] [a > b]
== ["Mo" "Larry" "Curly"]

red>> names
== ["Mo" "Larry" "Curly"]

red>> sort/compare names function [a b] [a < b]
== ["Curly" "Larry" "Mo"]

red>> names
== ["Curly" "Larry" "Mo"]

; -------------------------------------------------------------------------
; Specify which columns to compare using a path (e.g. /2)
; -------------------------------------------------------------------------
red>> names2: ["Larry" 45 "Curly" 50 "Mo" 42]
== ["Larry" 45 "Curly" 50 "Mo" 42]

red>> sort/skip/compare/all name-ages 2 function [a b][a/2 > b/2]
== ["Curly" 50 "Larry" 45 "Mo" 42] ; Sorted by descending age

red>> name-ages
== ["Curly" 50 "Larry" 45 "Mo" 42]
top alphanumeric-index category-index

Red word:    source    type=function!

Categories to which this word belongs: Documentation, Help & Debug

Description
The word source shows the source code of a mezzanine word. 
Does not return a value.

A mezzanine word is a Red word! that is defined in terms of Red itself.

Has 1 parameter, the name of an existing Red word,
Examples
source join
join: func [
"Concatenates values."
value "Base value"
rest "Value or block of values"
][
value: either series? :value [copy value] [form :value]
repend value :rest
]
top alphanumeric-index category-index

Red word:    space    type=char!

Categories to which this word belongs: Constants

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    spec-of    type=function!

Categories to which this word belongs: Reflection

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    split    type=function!

Categories to which this word belongs: String manipulation

Description
The word split breaks a string! into pieces using the provided delimiters.   
A block! is returned containing the individual pieces.

The arguments are:
a series - any-string! - the string to be split.
a delimiter - string! or char! - the delimiter
Note that the char! datatype has some common delimeters
predefined (such as '.newline', 'tab', 'space'. 'escape' etc.)
Examples
; -------------------------------------------------------------------------
; Split with a space
; -------------------------------------------------------------------------
red>> s1: "A few words"
== "A few words"

red>> split s1 " "
== ["A" "few" "" "" "" "" "" "words"]

; -------------------------------------------------------------------------
; Use the predefined constant "space"
; -------------------------------------------------------------------------
red>> split s1 space
== ["A" "few" "" "" "" "" "" "words"]
top alphanumeric-index category-index

Red word:    split-path    type=function!

Categories to which this word belongs: Directories, Files

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    square-root    type=native!

Categories to which this word belongs: Math

Description
The word square-root returns the square-root of a number!.

Its argument must be a number! type.
Examples
; -------------------------------------------------------------------------
; Square-root of integer! gives a float!
; -------------------------------------------------------------------------
red>> square-root 16
4.0

; -------------------------------------------------------------------------
; Square-root of a float!
; -------------------------------------------------------------------------
red>> square-root 4.1
2.024845673131658

; -------------------------------------------------------------------------
; Square-root of a negative number (NaN = Not a Number)
; -------------------------------------------------------------------------
red>> square-root -9
1.#NaN

; -------------------------------------------------------------------------
; Square-root of a pair! (invalid operation))
; -------------------------------------------------------------------------
red>> square-root 22x33
*** Script error: square-root does not allow pair! for its value argument
*** Where: square-root
top alphanumeric-index category-index

Red word:    stats    type=native!

Categories to which this word belongs: System Related

Description
The word stats returns interpreter statistics, including 
memory management data.

Refinements
/show - not yet implemented
/info - more detailed data
Examples
; -------------------------------------------------------------------------
; Basic stats
; -------------------------------------------------------------------------
red>> stats
== 86605824

; -------------------------------------------------------------------------
; More detailed stats (Can be a large block!, hence the ...)
; -------------------------------------------------------------------------
red>> print mold stats/info
== [[[9999 1 10000] [9999 1 10000] [9999 1 10000] [9999 1 10000] [...
top alphanumeric-index category-index

Red word:    strict-equal?    type=native!

Categories to which this word belongs: Comparison

Description
The word strict-equal? returns true if two values are equal
and are of the same datatype!, otherwise returns false.

When comparing strings lowercase is considered not equal to uppercase.
Examples
red>> strict-equal? 12 12.0
== false

red>> strict-equal? "abc" "abc"
== true

red>> strict-equal? "abC" "ABC"
== false
top alphanumeric-index category-index

Red word:    string!    type=datatype!

Categories to which this word belongs: Datatypes

Description
The datatype! string! represents a series! type containing ASCII
characters.
Examples
; -------------------------------------------------------------------------
; Some examples
; -------------------------------------------------------------------------
red>> str: "abcdefg"
== "abcdefg"

red>> str/3
== #"c" ; Representation of a single character in Red
top alphanumeric-index category-index

Red word:    string?    type=function!

Categories to which this word belongs: Type Checking

Description
The word string? returns true if its argument is
a string!, otherwise false.

Its argument can be of any type.
Examples
; -------------------------------------------------------------------------
; Test a string!
; -------------------------------------------------------------------------
red>> string? "abc"
true

; -------------------------------------------------------------------------
; Test a char!
; -------------------------------------------------------------------------
red>> string? #"A"
false

; -------------------------------------------------------------------------
; Test a number!
; -------------------------------------------------------------------------
red>> string? 12.34
false
top alphanumeric-index category-index

Red word:    subtract    type=action!

Categories to which this word belongs: Math

Description
The word subtract subtracts the second value from the first.
It is equivalent of the infix operator -.

It has 2 arguments, which can be of these types:
number! char! pair! tuple! vector!
Examples
red>> subtract 3.4 2
== 1.4

red>> v: make vector! [2 3 4]
== make vector! [2 3 4]

red>> v2: make vector! [10 100 200]
== make vector! [10 100 200]

red>> subtract v v2
== make vector! [-8 -97 -196]

red>> subtract 20x10 3x3
== 17x7

red>> subtract 10 3x3
*** Script error: subtract does not allow pair for its value2 argument
*** Where: subtract

red>> subtract 3x3 10
== -7x-7
top alphanumeric-index category-index

Red word:    suffix?    type=function!

Categories to which this word belongs: Directories, Files

Description
The word suffix? returns the extension of a file!, 
the suffix of a url!, otherwise returns none.

Note that when a suffix is found, a file! type is returned.

Its single argument can be:
file! url! string!
Examples
; -------------------------------------------------------------------------
; File with extension (The % is used in literal files)
; -------------------------------------------------------------------------
red>> suffix? %myfile.txt
%.txt

; -------------------------------------------------------------------------
; File without extension
; -------------------------------------------------------------------------
red>> suffix? %myfile
none

; -------------------------------------------------------------------------
; URL with suffix
; -------------------------------------------------------------------------
red>> suffix? http://www.place.org/info.html
%.html

; -------------------------------------------------------------------------
; URL without suffix
; -------------------------------------------------------------------------
red>> suffix? http://www.google.com/
none

; -------------------------------------------------------------------------
; File with extension as a string!
; -------------------------------------------------------------------------
red>> suffix? "data.txt"
%.txt
top alphanumeric-index category-index

Red word:    swap    type=action!

Categories to which this word belongs: Series, String manipulation

Description
The word swap swaps elements between two series! or the same series!.  
It modifies both arguments.

The 2 arguments must be of type series!
Examples
; -------------------------------------------------------------------------
; Create 2 series to work with (different lengths)
; -------------------------------------------------------------------------
red>> s1: [1 2 3 4 5 6]
== [1 2 3 4 5 6]

red>> s2: [100 200 300 400]
== [100 200 300 400]

red>> swap s1 s2 ; Swap first elements
== [100 2 3 4 5 6]

red>> s1
== [100 2 3 4 5 6] ; s1 was changed

red>> s2
== [1 200 300 400] ; s2 also changed

; -------------------------------------------------------------------------
; Swap within same series; arg 1 is element 1; arg 2 is element 100
; -------------------------------------------------------------------------
red>> ser: [ 1 2 3 4 5 100 200 300 400]
== [1 2 3 4 5 100 200 300 400]

red>> swap ser find ser 100
== [100 2 3 4 5 1 200 300 400]

; -------------------------------------------------------------------------
; Also string!s are series!!
; -------------------------------------------------------------------------
red>> swap "ABC" "xyz" ; Swap first characters of each string
== "xBC"

; -------------------------------------------------------------------------
; Swap in the middle of some series!
; -------------------------------------------------------------------------
red>> sa: [22 11 33 55]
== [22 11 33 55]

red>> sb: [105 101 107 109]
== [105 101 107 109]

red>> swap find sa 33 find sb 101
== [101 55]

red>> sa
== [22 11 101 55]

red>> sb
== [105 33 107 109]
top alphanumeric-index category-index

Red word:    switch    type=native!

Categories to which this word belongs: Conditional branching

Description
The word switch chooses a block! based on a value.  

We provide a value (which can be an expression of any type), then a
series of block!s, each prefixed with a value.

The block associated with the matching value is evaluated.
The prefixed values are not evaluated (Note that differing types are allowed).

The value of the last evaluation in the matched block is returned.

Refinements
/default - allows us to specify a default block! at
the bottom of the switch, which is executed
when no value matches
Examples
; -------------------------------------------------------------------------
; We try to match on different datatypes here
; -------------------------------------------------------------------------

switch 23.77.44 [
1 [print "1: integer"]
23.77.44 [print "23.77.44: a tuple"]
"India" [print "India: string"
country: true]
]
23.77.44: a tuple

; -------------------------------------------------------------------------
; Using the /default refinement where nothing matches with "China"
; -------------------------------------------------------------------------

item: "China"
switch/default item [
1 [print "1: integer"]
23.77.44 [print "23.77.44: a tuple"]
"India" [print "India: string"
country: true]
] [
print "No match"
]
No match
top alphanumeric-index category-index

Red word:    tail    type=action!

Categories to which this word belongs: Series, String manipulation

Description
The word tail can be used to set a series! index right
after the last item in the series!.

The word tail? can be used to test if a series! is at tail.

The word index? can be used to obtain the current index.
Examples
red>> x: [1 2 3 4 5]
== [1 2 3 4 5]

red>> head? x
== true

red>> index? x
== 1

red>> x: tail x
== []

red>> tail? x
== true

red>> index? x
== 6 ; Note that the index is one beyond the last element!
top alphanumeric-index category-index

Red word:    tail?    type=action!

Categories to which this word belongs: Series, String manipulation

Description
The word tail? tests if a series! is at tail position; 
it returns true if at tail or false otherwise.

The word index? can be used to obtain the current index.
Examples
red>> x: [1 2 3 4 5]
== [1 2 3 4 5]

red>> head? x
== true

red>> index? x
== 1

red>> x: tail x
== []

red>> tail? x
== true

red>> index? x
== 6 ; Note that the index is one beyond the last element!
top alphanumeric-index category-index

Red word:    take    type=action!

Categories to which this word belongs: Series

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    tan    type=routine!

This word is a synonym for tangent
top alphanumeric-index category-index

Red word:    tangent    type=native!

Categories to which this word belongs: Math

Description
The word tangent returns the trigonometric tangent of a number!
of degrees.

It has one numeric parameter.

Refinements:
/radians : expects the input value in radians;
without refinement expects the input value in degrees.
Examples
tangent 45
== 1.0

tangent 60 * 1.1
== 2.246036773904216

tangent/radians 1.05
== 1.74331530998317
top alphanumeric-index category-index

Red word:    third    type=function!

Categories to which this word belongs: Series, String manipulation

Description
The word third returns the third value in a series! (also string!s).

The argument can be one of:
series! tuple! pair!

If there is no third item, none is returned.
Examples
; -------------------------------------------------------------------------
; Third of block
; -------------------------------------------------------------------------
red>> third [2 3 4 5]
== 4

; -------------------------------------------------------------------------
; Third of a string is a character type
; -------------------------------------------------------------------------
red>> third "ABCDE"
== #"C"

; -------------------------------------------------------------------------
; Third of a tuple
; -------------------------------------------------------------------------
red>> third 22.33.44.55
== 44

; -------------------------------------------------------------------------
; No third here
; -------------------------------------------------------------------------
red>> third[44]
== none
top alphanumeric-index category-index

Red word:    throw    type=native!

Categories to which this word belongs: Error

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    time?    type=function!

Categories to which this word belongs: Unknown

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    to    type=action!

Categories to which this word belongs: Casting Types, Conversion

Description
The word to converts a value to a specified datatype!.  
Only specific conversions are allowed.

Arguments:
type - a datatype! name. Note that this name can be the result of an evaluation.
spec - the attributes of the new value. Often, this is simply the value itself.
Examples
; -------------------------------------------------------------------------
; Do some simple conversions
; -------------------------------------------------------------------------
red>> to integer! 2.333
2

red>> to string! 234
"234"

red>> to integer! "23456"
23456

; -------------------------------------------------------------------------
; Compute the new type
; -------------------------------------------------------------------------
red>> affect: true
true

red>> to either affect [float!] [string!] 567
567.0
top alphanumeric-index category-index

Red word:    to-hex    type=native!

Categories to which this word belongs: Bases of Numbers

Description
The word to-hex converts an integer! to a hexadecimal 
value, with a leading # and leading zeroes.

Its argument is an integer!.

Refinements
/size - an integer! specifying the number of
hexadecimal digits in the result.
No errors result if a small size value
removes significant parts of the result.
Examples
; -------------------------------------------------------------------------
; Conversions of positive and negative integer!s
; -------------------------------------------------------------------------
red>> to-hex 64
#00000040

red>> to-hex -1
#FFFFFFFF

red>> to-hex 2 ** 31
== #80000000 ; Left most bit (= sign bit) is set

; -------------------------------------------------------------------------
; Limit digits with /size (from the right)
; -------------------------------------------------------------------------
red>> to-hex/size 64 4
#0040
top alphanumeric-index category-index

Red word:    to-image    type=function!

Categories to which this word belongs: Unknown

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    to-local-file    type=native!

Categories to which this word belongs: Directories, Files

Description
The word to-local-file converts standard, system independent Red 
file paths to the file format used by the local operating system.

The path argument must be a file! or a string!.

Refinements
/full - prepends current dir for full path (for relative paths only)
Examples
; -------------------------------------------------------------------------
; Windows - using Red file!
; -------------------------------------------------------------------------
red>> to-local-file %/c/data.txt
"c:\data.txt"

; -------------------------------------------------------------------------
; Windows - using a string!
; -------------------------------------------------------------------------
red>> to-local-file "/c/data.txt"
"c:\data.txt"

; -------------------------------------------------------------------------
; Windows - with /full refinement
; -------------------------------------------------------------------------
red>> what-dir
== %/E/Websites/Red-by-Example/auto-v5/ ; Current directory

red>> to-local-file/full %data.txt ; Relative path
== "E:\Websites\Red-by-Example\auto-v5\data.txt"
top alphanumeric-index category-index

Red word:    to-red-file    type=function!

Categories to which this word belongs: Directories, Files

Description
The word to-red-file converts a local file system path to Red's 
standard machine independent path format.

The argument can be:
- a Red file!
- a string!.

Note that a Red file path - preceded by % - cannot contain a colon (:)
as used in Windows paths, though it can contain \.
The string argument can contain a colon (:).
Examples
; -------------------------------------------------------------------------
; Convert a file containing backslashes
; -------------------------------------------------------------------------
red>> to-red-file %\data\notes.txt
%/data/notes.txt

; -------------------------------------------------------------------------
; Convert a Windows file in a string
; -------------------------------------------------------------------------
red>> to-red-file "C:\data\notes.txt"
%/C/data/notes.txt
top alphanumeric-index category-index

Red word:    trim    type=action!

Categories to which this word belongs: String manipulation

Description
word trim removes white space (tabs and spaces) from a string! or none 
from a block! or object!. The value of the argument is altered.

The argument can be one of: series! object! error! map!

Refinements
/head - Removes only from the head.
/tail - Removes only from the tail.
/auto - Auto indents lines relative to first line.
/lines - Removes all line breaks and extra spaces.
/all - Removes all whitespace (but not line breaks).
/with - Same as /all, but removes characters in a 'with' argument we supply.
It must be one of: char! string! integer!
Examples
; -------------------------------------------------------------------------
; Basic trim.
; -------------------------------------------------------------------------
red>> str: " some text "
== " some text "

red>> trim str ; Both head and tail are trimmed
== "some text"

red>> str
== "some text" ; str was altered by trim

; -------------------------------------------------------------------------
; Multiple lines of text - enclosed in { }
; -------------------------------------------------------------------------
red>> str: {Four lines
{ of varying levels
{ of
{ indentation.}
== {Four lines^/ of varying levels^/ of^/ indentation.}

red>> trim str ; ^/ means a newline
== {Four lines^/of varying levels^/of^/indentation.}

; -------------------------------------------------------------------------
; Trim a block! - NB reduce evaluates every element in a block
; -------------------------------------------------------------------------
red>> blk: [none none 3 none]
== [none none 3 none]

red>> trim blk
== [none none 3 none] ; Because elements are not yet evaluated

red>> blk
== [none none 3 none] ; Trim did not alter the block

red>> trim reduce blk
== [3] ; Now trim worked succesfully!

; -------------------------------------------------------------------------
; /head - trim head only
; -------------------------------------------------------------------------
red>> trim/head " AAA "
== "AAA "

; -------------------------------------------------------------------------
; /tail - trim tail only
; -------------------------------------------------------------------------
red>> trim/tail " AAA "
== " AAA"

; -------------------------------------------------------------------------
; /lines - NB last line has line break at end
; -------------------------------------------------------------------------
red>> str: { Two lines
{ of text
{ }
== " Two lines ^/ of text^/ "

red>> trim/lines str
== "Two lines of text" ; Multiple spaces and line breaks are gone

; -------------------------------------------------------------------------
; /all - remove all space
; -------------------------------------------------------------------------
red>> trim/all " some text "
== "sometext"

; -------------------------------------------------------------------------
; /with - Note that spaces are not removed automatically
; -------------------------------------------------------------------------
red>> str: "some extra-characters,, to use"
== "some extra-characters,, to use"

red>> trim/with str ",-"
== "some extracharacters to use" ; , and - removed

red>> str: "some extra-characters,, to use"
== "some extra-characters,, to use"

red>> trim/with str ",- "
== "someextracharacterstouse" ; Now also spaces removed
top alphanumeric-index category-index

Red word:    true    type=logic!

Categories to which this word belongs: Boolean, Constants

Description
The word true has the logical value "true" 
and its datatype! is logic!

Logical values are produced from various comparisons.

The logic! type also provides:
false, no, off, on, true, yes
Examples
3 = 3.0
== true

3 == 3.0
== false

3 = 4
== false

"abc" = "abc"
== true

"ABC" = "abc"
== true

if 4 > 3 [print "it is"]
-- it is

a: true
== true

b: 4 > 3
== true
top alphanumeric-index category-index

Red word:    try    type=native!

Categories to which this word belongs: Error

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    tuple!    type=datatype!

Categories to which this word belongs: Datatypes

Description
The  datatype! tuple! is a list of 3 up to 12 bytes. 
It offers a versatile way to represent different kind of values such as
version numbers, IP addresses , and colours (example: 0.255.0).

The value of each item in a tuple must be in the range 0 to 255.

Once a tuple! value is created, its size cannot be changed anymore (it is not a series!),
but its elements can still be modified, using, for example, path syntax.

The following actions are supported by tuple! values:
random, add, divide, multiply, remainder, subtract,
and, or, xor, length?, pick, poke, reverse.

Math operations are allowed with some other scalar datatypes where a result is sensible,
like integer!, float! and percent!.

Examples
; -------------------------------------------------------------------------
; Create 2 tuples
; -------------------------------------------------------------------------
red>> t1: 6.3.2
== 6.3.2

red>> t2: 100.200.64.32
== 100.200.64.32

; -------------------------------------------------------------------------
; Path syntax to access and modify an element
; -------------------------------------------------------------------------
red>> t2/2
== 200

red>> t2/2: 250
== 250

red>> t2
== 100.250.64.32

; -------------------------------------------------------------------------
; Add the tuples
; -------------------------------------------------------------------------
red>> t1 + t2
== 106.253.66.32

; -------------------------------------------------------------------------
; Add an integer - note clipping at 255
; -------------------------------------------------------------------------
red>> t2 + 200
== 255.255.255.232

; -------------------------------------------------------------------------
; Get help on defined colours
; -------------------------------------------------------------------------
red>> help tuple!
aqua : 40.100.130
beige : 255.228.196
black : 0.0.0
blue : 0.0.255
brick : 178.34.34
... and 100 or so lines more, not shown here

; -------------------------------------------------------------------------
; Compare pre-defined colours
; -------------------------------------------------------------------------
red>> red + green = yellow
== true
top alphanumeric-index category-index

Red word:    tuple?    type=function!

Categories to which this word belongs: Type Checking

Description
The word tuple? returns true if its argument is a tuple!, 
otherwise false.

Its argument can be of any type.
Examples
; -------------------------------------------------------------------------
; Test a valid tuple!
; -------------------------------------------------------------------------
red>> t: 22.44.33
22.44.33

red>> tuple? t
true

; -------------------------------------------------------------------------
; Test an integer
; -------------------------------------------------------------------------
red>> n: 123
123

red>> tuple? n
false
top alphanumeric-index category-index

Red word:    type?    type=native!

Categories to which this word belongs: Type Checking

Description
The word type? returns the datatype! of a value.

The argument can be of any type.
Examples
; -------------------------------------------------------------------------
; Get the type of several items
; -------------------------------------------------------------------------
red>> type? 123
== integer!

red>> type? [1 2 3]
== block!

red>> x: 22x33
== 22x33

red>> type? x
== pair!
top alphanumeric-index category-index

Red word:    typeset!    type=datatype!

Categories to which this word belongs: Datatypes

Description
The datatype! typeset! lets us create a set of types and name them.  

Internally, a typeset is stored in a compact array of bits, for fast access
at run-time. By convention, typeset! names should end with a !

The following words are supported with typeset!s:
make
form
mold
and
or
xor
complement
clear
find
insert
append
length?.

Comparison operators are also supported.

Typesets cannot be built from existing typesets; use the low-level types instead.
Examples
; -------------------------------------------------------------------------
; Red uses typeset!s internally:
; -------------------------------------------------------------------------
red>> ? typeset!
any-block! : make typeset! [block! paren! path! lit-path! set-path!
get-path! hash!]
any-function! : make typeset! [native! action! op! function! routine!]
any-list! : make typeset! [block! paren! hash!]
any-object! : make typeset! [object! error!]
any-path! : make typeset! [path! lit-path! set-path! get-path!]
any-string! : make typeset! [string! file! url!]
any-type! : make typeset! [datatype! unset! none! logic! block!
paren! string! file! url! char! integer!
float! word! set-word! lit-word! get-word!
refinement! issue! native! action! op!
function! path! lit-path! set-path!
get-path! routine! bitset! object! typeset!
error! vector! hash! pair! percent! tuple!
map! binary! time! image! event!]
any-word! : make typeset! [word! set-word! lit-word! get-word!
refinement! issue!]
default! : make typeset! [datatype! none! logic! block! paren!
string! file! url! char! integer! float!
word! set-word! lit-word! get-word!
refinement! issue! native! action! op!
function! path! lit-path! set-path!
get-path! routine! bitset! object!
typeset! error! vector! hash! pair!
percent! tuple! map! binary! time! image!]
immediate! : make typeset! [datatype! none! logic! char! integer!
float! word! set-word! lit-word!
get-word! refinement! issue! typeset!
pair! percent! tuple! time!]
internal! : make typeset! [unset! event!]
my-type! : make typeset! [integer! pair! tuple!]
number! : make typeset! [integer! float! percent!]
scalar! : make typeset! [char! integer! float! pair! percent! tuple! time!]
series! : make typeset! [block! paren! string! file! url! path! lit-path!
set-path! get-path! vector! hash! binary! image!]

; -------------------------------------------------------------------------
; Make a new type
; -------------------------------------------------------------------------
red>> my-type!: make typeset! [pair! tuple! integer!]
== make typeset! [integer! pair! tuple!]

; -------------------------------------------------------------------------
; Create a function which uses the type
; -------------------------------------------------------------------------
red>> show-it: function [x [my-type!] ] [ print x ]

; -------------------------------------------------------------------------
; Try it with pair, tuple, integer
; -------------------------------------------------------------------------
red>> show-it 30x40 ; pair! is part of this typeset!
30x40

red>> show-it 33.44.2 ; tuple! is part of this typeset!
33.44.2

red>> show-it 234 ; integer! is part of this typeset!
234

red>> show-it 23.45 ; float! is NOT part of this typeset!
*** Script error: show-it does not allow float! for its x argument
*** Where: show-it

; -------------------------------------------------------------------------
; Try to make a typeset from the existing typeset! number!
; -------------------------------------------------------------------------
red>> t!: make typeset![number!]
*** Script error: invalid argument: number!
*** Where: make
red>>

top alphanumeric-index category-index

Red word:    typeset?    type=function!

Categories to which this word belongs: Type Checking

Description
The word typeset? returns true if its argument is a typeset!, 
otherwise false.

The argument can be of any type
Examples
; -------------------------------------------------------------------------
; integer! is a type, not a typeset!
; -------------------------------------------------------------------------
red>> typeset? integer!
== false

; -------------------------------------------------------------------------
; number! is a typeset!
; -------------------------------------------------------------------------
red>> typeset? number!
== true

red>> ? number!
number! is a typeset! of value: make typeset! [integer! float! percent!]

; -------------------------------------------------------------------------
; Test a self made typeset!
; -------------------------------------------------------------------------
red>> my-type!: make typeset! [pair! tuple! integer!]
== make typeset! [integer! pair! tuple!]

red>> typeset? my-type!
== true
top alphanumeric-index category-index

Red word:    union    type=native!

Categories to which this word belongs: Sets

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    unique    type=native!

Categories to which this word belongs: Series, Sets

Description
The word unique takes a series! as its argument and removes 
all duplicates.

Refinements:
/skip - groups of items are made unique
Examples
; -------------------------------------------------------------------------
; Leave only the unique values
; -------------------------------------------------------------------------
red>> unique [1 2 3 4 2 5 4 1 3 2]
== [1 2 3 4 5]

; -------------------------------------------------------------------------
; Make groups of 2 items unique
; -------------------------------------------------------------------------
red>> unique/skip [1 2 3 4 1 2 3 4 5 6 7 8 5 6] 2
== [1 2 3 4 5 6 7 8]

; -------------------------------------------------------------------------
; Unique characters in a string!
; -------------------------------------------------------------------------
red>> unique "abcbcdcdedefefg"
== "abcdefg"

; -------------------------------------------------------------------------
; Unique groups of 3 characters
; -------------------------------------------------------------------------
red>> unique/skip "abcdefabcghijklmnoghi" 3
== "abcdefghijklmno"
top alphanumeric-index category-index

Red word:    unless    type=native!

Categories to which this word belongs: Conditional branching

Description
The word unless evaluates the block! if the condition is NOT true,
returning the value of the block; otherwise returns none.

The arguments are a condition, and a block!.

Using unless is equivalent to using if not.
Examples
age: 18
unless (age < 18) or (age > 100) [print "Within Range"]
Within range

if not( (age < 18) or (age > 100)) [print "Within Range"]
Within range
; equivalent if (for previous unless example)

if (age >= 18) and (age <= 100) [print "Within Range"]
Within range
; same with condition rewritten
top alphanumeric-index category-index

Red word:    unset    type=native!

Categories to which this word belongs: Word Manipulation

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    unset!    type=datatype!

Categories to which this word belongs: Datatypes, Word Manipulation

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    unset?    type=function!

Categories to which this word belongs: Word Manipulation

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    until    type=native!

Categories to which this word belongs: Iteration

Description
The word until evaluates its block! argument until the block!
returns a true value.

It has one argument, a block!.
Examples
n: 5
until [
print n
n: n - 1
n < 0
]
5
4
3
2
1
0
== true
top alphanumeric-index category-index

Red word:    unview    type=function!

Categories to which this word belongs: GUI (VID)

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    uppercase    type=native!

Categories to which this word belongs: String manipulation

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    url!    type=datatype!

Categories to which this word belongs: Datatypes, URL

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    url?    type=function!

Categories to which this word belongs: Type Checking, URL

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    value?    type=native!

Categories to which this word belongs: Type Checking

Description
The word value? returns true if the argument is a Red word!
that has been set; otherwise returns false.

It has 1 argument, a word!, which is passed as a literal
or as the result of other operations.
Examples
a: 33
== 33

value? 'a
== true

a: none
== none

value? 'a
== true

value? 'fish
== false

value? second [a fish]
== false

value? fish
*** Script error: fish has no value
*** Where: value?
; NOTE the error message;
; we must prevent evaluation of the word by using ' or [ ].
top alphanumeric-index category-index

Red word:    values-of    type=function!

Categories to which this word belongs: Reflection

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    vector!    type=datatype!

Categories to which this word belongs: Datatypes

Description
The datatype! vector! represents a series! type.

A vector! is a high-performance series! of items.
The items in a vector! must all have the same type (unlike a block!).

The allowable item types are:
integer! float! char! percent!
Vectors of string! are not allowed.

To create a vector, we use make, as in:
v-ages: make vector! [80 18 65]

At least one value must be given, to allow to determine the type.
Examples
; -------------------------------------------------------------------------
; First create a vector! of integer!
; -------------------------------------------------------------------------
red>> v-ages: make vector! [80 18 65]
== make vector! [80 18 65]

red>> print v-ages
80 18 65

red>> print mold v-ages
make vector! [80 18 65]

; -------------------------------------------------------------------------
; Add a new item to that vector!
; -------------------------------------------------------------------------
red>> append v-ages 99
== make vector! [80 18 65 99]

red>> print v-ages
80 18 65 99

; -------------------------------------------------------------------------
; Obtain the length of it
; -------------------------------------------------------------------------
red>> print length? v-ages
4

; -------------------------------------------------------------------------
; Extract an item using path notation
; -------------------------------------------------------------------------
red>> print v-ages/2
18

; -------------------------------------------------------------------------
; Return sub series! starting with found item
; -------------------------------------------------------------------------
red>> find v-ages 18
== make vector! [18 65 99]

; -------------------------------------------------------------------------
; Loop through a vector!
; -------------------------------------------------------------------------
red>> grades: make vector![ #"A" #"B" #"F"]
== make vector! [#"A" #"B" #"F"]

red>> foreach grade grades [print grade]
A
B
F
top alphanumeric-index category-index

Red word:    vector?    type=function!

Categories to which this word belongs: Type Checking

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    view    type=function!

Categories to which this word belongs: GUI (VID)

Description
The function view is used to:
- declare a GUI layout using VID
- invoke that GUI layout
Examples
Red [
needs: 'view
]

view [
below
text "Line 1"
text "Line 2"
]
top alphanumeric-index category-index

Red word:    wait    type=native!

Categories to which this word belongs: System Related

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    what    type=function!

Categories to which this word belongs: Documentation, Help & Debug

Description
The word what displays brief information about every Red function,
one per line.

Has no arguments or refinements.
Examples
red>> what
to : Converts to a specified datatype
not : Returns the negation (logical complement) of a value
remove : Returns the series at the same index after removing a value
while : Evaluates body as long as condition is true
any : Evaluates, returning at the first that is true
copy : Returns a copy of a non-scalar value
insert : Inserts value(s) at series index; returns series head
if : If condition is true, evaluate block; else return NONE
... a lot more lines are displayed ... omitted here
top alphanumeric-index category-index

Red word:    what-dir    type=function!

Categories to which this word belongs: Files

Description
The word what-dir returns the active directory path as a file! value.

It has no arguments.

Irrespective of the operating system, it uses / in file paths.

Literal file paths must start with the % sign:
So, e.g. c:\windows\system32 must be represented as %/c/windows/system32
Examples
a: what-dir
== %/C/rebol/

type? a
== file!
top alphanumeric-index category-index

Red word:    while    type=native!

Categories to which this word belongs: Iteration

Description
The word while has two arguments:
- a condition block!
- a body block!

As long as the condition block! returns true, the body block!
will be evaluated.

NOTE that in Red, a block! can contain several evaluations; only the value
resulting from the final evaluation influences the while condition.

The break word can be used to braek out of the body block!.

In the case where several conditions control the loop continuation, you might
require short-circuit evaluation of the condition using all.

When working with series!, you should investigate existing functions like
first, rather than writing complex loops.
Examples
count: 1
while [count <= 5] [
print count
count: count + 1
]
print "Done"
print count
1
2
3
4
5
Done
== 6

while [all [ n < 10 still-ok] ] [
body ; which might alter n and/or still-ok
]
; Either condition going false will terminate the loop.
; The extra [ ] are because the condition must be inside a block.
top alphanumeric-index category-index

Red word:    within?    type=function!

Categories to which this word belongs: Math

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    word!    type=datatype!

Categories to which this word belongs: Datatypes

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    word?    type=function!

Categories to which this word belongs: Type Checking

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    words-of    type=function!

Categories to which this word belongs: Reflection

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    write    type=action!

Categories to which this word belongs: Directories, Files, Output

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    xor    type=op!

Categories to which this word belongs: Bit manipulation

Description
The word xor returns the exclusive "or" of its two arguments.

The type of both arguments can be:
logic! integer! char! bitset! typeset! pair! tuple! vector!

xor provides a sensible interpretation of "true when different"
for types and combinations of types.

The result type is determined by the type of the first argument.

Certain combinations of types are disallowed.
Examples
3 xor 2
== 1

3x3 xor 2x2 ;pairs
== 1x1

3x0 xor 3x1
== 0x1

#"A" xor 2 ;character, number
== #"C"

2 xor #"A"
== 67

#"A" xor 2
== #"C"

true xor false
== true

true xor true
== false

3 xor 2x1
*** Script error: xor does not allow pair for its value2 argument
*** Where: xor

123 xor true
*** Script error: logic type is not allowed here
*** Where: xor
top alphanumeric-index category-index

Red word:    xor~    type=action!

Categories to which this word belongs: Bit manipulation

To do by red-by-example team ...

top alphanumeric-index category-index

Red word:    yes    type=logic!

Categories to which this word belongs: Boolean, Constants

Description
The value yes can be used as the boolean value true.
Examples
red>> yes
== true

red>> not yes
== false
top alphanumeric-index category-index

Red word:    zero?    type=function!

Categories to which this word belongs: Comparison

Description
The word zero? returns true if its argument is zero; 
otherwise false.

Has one argument: a number! or a pair!.
Examples
zero? 3
== false

zero? 3.1
== false

zero? 0
== true

zero? 2x0
== false

zero? 0x0
== true
top alphanumeric-index category-index