Red by Example - an accessible reference by example

index

GUI: VID, View words in alphanumerical order

Parse dialect words in alphanumerical order

Draw Dialect words in alphanumerical order

Red words in alphanumerical order

Master index of categories

Category: Bases of Numbers

Category: Bit manipulation

Category: Boolean

Category: Casting Types

Category: Comparison

Category: Conditional branching

Category: Console

Category: Constants

Category: Create

Category: Conversion

Category: Colors

Category: Compression

Category: Directories

Category: Documentation

Category: Datatypes

Category: Draw Dialect

Category: Date/Time

Category: Error

Category: Evaluation

Category: Exiting

Category: Events

Category: Files

Category: Formatting

Category: Functions

Category: GUI: VID, View

Category: Help & Debug

Category: Input

Category: Iteration

Category: Logic

Category: Maps

Category: Math

Category: Macros

Category: Network

Category: Objects

Category: Output

Category: Parse

Category: Parse dialect

Category: Reflection

Category: Reactivity

Category: Series

Category: Sets

Category: Special Purpose

Category: String manipulation

Category: System Related

Category: Type Checking

Category: Unknown

Category: URL/Internet

Category: Word Manipulation

%

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!



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





*

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.



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





**

The infix word ** raises argument 1 to the power argument 2.



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





+

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! time! date!



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.



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





-

The infix word - 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! time! date!



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.



; -------------------------------------------------------------------------

; 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





/

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.



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





//

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.



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





across

The VID dialect word across is used to position GUI elements following that

word at the right hand side of the previous GUI element.



Red [

needs: 'view

]



view [

across

text "Line 1"

text "Line 2"

]







top alphanumeric-index category-index





all-over

Look in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





aqua

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



It is a tuple! of value 40.100.130



view [

text 100x50 aqua " "

]







top alphanumeric-index category-index





area

Provides a multi-line rectangle where text can be entered, selected, edited,

copied, pasted. We can choose the font-size, color, font, etc. Rich text

is not supported.



The default event-handler is on-change.



The text in the area can be accessed via the /text refinement.



Examples:



;-- an area with a size, specified font, and initial text.

a1: area white font [name: "Consolas" size: 12 color: black]

{area with

some text

}

120x70 [print "a1 changed"] ;-- on-change





There is a complete VID example in:



http://www.red-by-example.org/vid-text-red.html



There is an introduction to VID at:



http://www.red-by-example.org/vid.html



Its official View documentation is at:



https://doc.red-lang.org/en/view.html#_area



top alphanumeric-index category-index





at

Look in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





backdrop

Sets the background color of the container face.



Argument



backdrop



- name or value of a color (word! tuple! issue!).







view [

;-- set color, size, and title for window

backdrop green ;-- green window

size 300x200

title "Demo Window"

space 100x70 ;-- bigger horizontal spacing

b1: button "Hello"

b2: button "Goodbye"

return

]









top alphanumeric-index category-index





base

The most basic face type, but also the most versatile one. By default, it

will only display a background of color! 128.128.128. (Grey). It

provides transparency, and can be used for drawing.



The default event is on-down



VID Example:



base 140x140 %country.png ;-- supply image file name



There is a complete VID example in:



http://www.red-by-example.org/vid-misc-faces-red.html



There is an introduction to VID at:



http://www.red-by-example.org/vid.html



Its official View documentation is at:



https://doc.red-lang.org/en/view.html#_base





top alphanumeric-index category-index





beige

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



It is a tuple! of value 255.228.196



view [

text 100x50 beige " "

]







top alphanumeric-index category-index





below

The function below is used to position GUI elements following that

word below the previous GUI element.



Red [

needs: 'view

]



view [

below

text "Line 1"

text "Line 2"

]







top alphanumeric-index category-index





black

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



It is a tuple! of value 0.0.0



view [

text 100x50 black " "

]







top alphanumeric-index category-index





blue

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



It is a tuple! of value 0.0.255



view [

text 100x50 blue " "

]







top alphanumeric-index category-index





bold

Look in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





bottom

Look in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





box

This is a VID style. It is a base type, but with a default

transparent color.



The default event is on-down



There is a complete VID example in:



http://www.red-by-example.org/vid-misc-faces-red.html



There is an introduction to VID at:



http://www.red-by-example.org/vid.html



top alphanumeric-index category-index





brick

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



It is a tuple! of value 178.34.34



view [

text 100x50 brick " "

]







top alphanumeric-index category-index





brown

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



It is a tuple! of value 139.69.19



view [

text 100x50 brown " "

]







top alphanumeric-index category-index





button

A button is used to confirm something, or to simply invoke some

action.



Note that on-click and on-down do the same thing for a

button.



The default event is on-down.



In VID, here are 2 buttons.



button "Click me" [print "Clicked"] ;-- respond to down



button2: button "Try Me 2" ;-- named button

on-down [button2-down] ;-- respond to down - call a function

on-over [button2-over] ;-- respond to over (hover) - call a

function



There is a complete VID example in:



http://www.red-by-example.org/vid-misc-faces-red.html



There is an introduction to VID at:



http://www.red-by-example.org/vid.html



Its official View documentation is at:



https://doc.red-lang.org/en/view.html#_button





top alphanumeric-index category-index





camera



(Awaiting additional documentation by red-by-example team.)





top alphanumeric-index category-index





caret-to-offset

USAGE:

CARET-TO-OFFSET face pos



DESCRIPTION:

Given a text position, returns the corresponding coordinate relative

to the top-left of the layout box.

CARET-TO-OFFSET is a function! value.



ARGUMENTS:

face [object!]

pos [integer!]



REFINEMENTS:

/lower => lower end offset of the caret.



RETURNS:

[pair!]

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





center

Look in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





center-face

USAGE:

CENTER-FACE face



DESCRIPTION:

Center a face inside its parent.

CENTER-FACE is a function! value.



ARGUMENTS:

face [object!] "Face to center."



REFINEMENTS:

/x => Center horizontally only.

/y => Center vertically only.

/with => Provide a reference face for centering instead of parent face.

parent [object!] "Reference face."



RETURNS:

Returns the centered face.

[object!]

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





check

A check provides a check-box, with an optional label.



The default event is on-change



The boolean state exists in 'data'. Note that 'change' can mean true to

false, or false to true.



Here is a VID example which displays the current state when checked:



check1-changed: function [] [

print ["check1-has changed. Current state is: " check1/data]

]



view [

check1: check "Check me" [check1-changed]

]



There is a complete VID example in:



http://www.red-by-example.org/vid-choice-faces-red.html



There is an introduction to VID at:



http://www.red-by-example.org/vid.html



Its official View documentation is at:



https://doc.red-lang.org/en/view.html#_check





top alphanumeric-index category-index





coal

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



It is a tuple! of value 64.64.64



view [

text 100x50 coal " "

]







top alphanumeric-index category-index





coffee

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



It is a tuple! of value 76.26.0



view [

text 100x50 coffee " "

]







top alphanumeric-index category-index





crimson

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



It is a tuple! of value 220.20.60



view [

text 100x50 crimson " "

]







top alphanumeric-index category-index





cyan

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



It is a tuple! of value 0.255.255



view [

text 100x50 cyan " "

]







top alphanumeric-index category-index





data

Look in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





default!

DEFAULT! is a typeset! value: 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! tag! email! handle! date! image!

event!]

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





disabled

Look in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





distance?

USAGE:

DISTANCE? A B



DESCRIPTION:

Returns the distance between the center of two faces.

DISTANCE? is a function! value.



ARGUMENTS:

A [object!] "First face."

B [object!] "Second face."



RETURNS:

Distance between them.

[float!]

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





do

Look in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





do-events

USAGE:

DO-EVENTS



DESCRIPTION:

Launch the event loop, blocks until all windows are closed.

DO-EVENTS is a function! value.



REFINEMENTS:

/no-wait => Process an event in the queue and returns at once.



RETURNS:

Returned value from last event.

[logic! word!]

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





draw

USAGE:

DRAW image cmd



DESCRIPTION:

Draws scalable vector graphics to an image.

DRAW is a function! value.



ARGUMENTS:

image [image! pair!] "Image or size for an image."

cmd [block!] "Draw commands."



REFINEMENTS:

/transparent => Make a transparent image, if pair! spec is used.



RETURNS:

[image!]

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





draw

USAGE:

DRAW image cmd



DESCRIPTION:

Draws scalable vector graphics to an image.

DRAW is a function! value.



ARGUMENTS:

image [image! pair!] "Image or size for an image."

cmd [block!] "Draw commands."



REFINEMENTS:

/transparent => Make a transparent image, if pair! spec is used.



RETURNS:

[image!]

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





drop-down

A drop-down represents an edit field with a vertical list of text strings

displayed in a foldable frame. (i.e. a 'combo'). A vertical scrollbar

appears automatically if the content does not fit the frame.



The default event handler is on-enter.



The drop-down, drop-list, and text-list are related.



A none value for 'selection' is returned if no choice has been made.



The associative-array possibility exists, as in drop-list



It is possible to preset the edit field, which might be used as an initial

selection, or a prompt.



Example in VID:



drop-down1: drop-down "Choose Code" data ["A1" "A2" "B1" "B2"]



There is a complete VID example in:



http://www.red-by-example.org/vid-choice-faces-red.html



There is an introduction to VID at:



http://www.red-by-example.org/vid.html



Its official View documentation is at:



https://doc.red-lang.org/en/view.html#_drop_down



top alphanumeric-index category-index





drop-list

This type represents a vertical list of text strings, displayed in a

foldable frame. A vertical scrollbar appears automatically if the content

does not fit the frame.



The default event handler is on-change



The drop-down, drop-list, and text-list are related.

A none value for 'selection' is returned if no choice has been made.



A drop-down is similar, but it provides an additional edit field (a

'combo').



The drop-list only displays strings, though the 'data' values can include

other types. This can give an associative-array effect. For example, to

find the postage cost of a letter, we can use this in VID:



postal-drop-list: drop-list data["Basic" 33 "2nd-class" 40 "Priority" 99]



Only the 3 strings are displayed.



Multiplying the selected position by 2 would take us to the integer cost

item.



There is a complete VID example in:



http://www.red-by-example.org/vid-choice-faces-red.html



There is an introduction to VID at:



http://www.red-by-example.org/vid.html



Its official View documentation is at:



https://doc.red-lang.org/en/view.html#_drop_list





top alphanumeric-index category-index





dump-face

See the official View documents:

https://doc.red-lang.org/en/view.html



top alphanumeric-index category-index





event?

Look in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





extra

Look in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





facet

Look in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





field

A field provides single-line data entry. We can provide an initial text

value, and provide a different pixel width if the default width is

unsuitable.



The default event is on-enter.



We access the data entered with /text.



VID Examples:



f1: field ;-- default size, empty

f2: field "a field" ;-- default size, shows "a field"

f3: field "Enter name here" 200 ;-- wider



There is a complete VID example in:



http://www.red-by-example.org/vid-text-red.html



There is an introduction to VID at:



http://www.red-by-example.org/vid.html



Its official View documentation is at:



https://doc.red-lang.org/en/view.html#_field





top alphanumeric-index category-index





find-flag?

Look in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





focus

Look in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





font

Look in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





font-color

Look in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





font-name

Look in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





font-size

Look in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





foreach-face

USAGE:

FOREACH-FACE face body



DESCRIPTION:

Evaluates body for each face in a face tree matching the condition.

FOREACH-FACE is a function! value.



ARGUMENTS:

face [object!] "Root face of the face tree."

body [block! function!] {Body block (`face` object) or

function `func [face [object!]]`.}



REFINEMENTS:

/with => Filter faces according to a condition.

spec [block! none!] "Condition applied to face object."

/post => Evaluates body for current face after processing its

children.

/sub =>

post? "Do not rebind body and spec, internal use only."

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





forest

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



It is a tuple! of value 0.48.0



view [

text 100x50 forest " "

]







top alphanumeric-index category-index





get-scroller

USAGE:

GET-SCROLLER face orientation



DESCRIPTION:

return a scroller object from a face.

GET-SCROLLER is a function! value.



ARGUMENTS:

face [object!]

orientation [word!]



RETURNS:

[object!]

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





glass

The VID dialect provides named colors. Each color has a tuple! value.



For example, here we create a brown text element:



view [

text 100x50 brown " "

]





top alphanumeric-index category-index





gold

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



It is a tuple! of value 255.205.40



view [

text 100x50 gold " "

]







top alphanumeric-index category-index





gray

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



It is a tuple! of value 128.128.128



view [

text 100x50 gray " "

]







top alphanumeric-index category-index





green

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



It is a tuple! of value 0.255.0



view [

text 100x50 green " "

]







top alphanumeric-index category-index





group-box

(Awaiting additional documentation by red-by-example team.)



Possible phasing-out.



top alphanumeric-index category-index





h1

The VID dialect has some defined styles (shortcuts). The styles h1 h2 h3

h4 h5 display text of a pre-defined size. The largest is h1. We have:



h1 - a text preset to font-size 32

h2 - a text preset to font-size 26

h3 - a text preset to font-size 22

h4 - a text preset to font-size 17

h5 - a text preset to font-size 13



Here is an example:



h1 "Biggest Text Heading"

message: h3 "Medium-sized yellow heading..." yellow





http://www.red-by-example.org/vid-text-faces-red.html



There is an introduction to VID at:



http://www.red-by-example.org/vid.html



top alphanumeric-index category-index





h2

The VID dialect has some defined styles (shortcuts). The styles h1 h2 h3

h4 h5 display text of a pre-defined size. The largest is h1. We have:



h1 - a text preset to font-size 32

h2 - a text preset to font-size 26

h3 - a text preset to font-size 22

h4 - a text preset to font-size 17

h5 - a text preset to font-size 13



Here is an example:



h1 "Biggest Text Heading"

message: h3 "Medium-sized yellow heading..." yellow





http://www.red-by-example.org/vid-text-faces-red.html



There is an introduction to VID at:



http://www.red-by-example.org/vid.html



top alphanumeric-index category-index





h3

The VID dialect has some defined styles (shortcuts). The styles h1 h2 h3

h4 h5 display text of a pre-defined size. The largest is h1. We have:



h1 - a text preset to font-size 32

h2 - a text preset to font-size 26

h3 - a text preset to font-size 22

h4 - a text preset to font-size 17

h5 - a text preset to font-size 13



Here is an example:



h1 "Biggest Text Heading"

message: h3 "Medium-sized yellow heading..." yellow





http://www.red-by-example.org/vid-text-faces-red.html



There is an introduction to VID at:



http://www.red-by-example.org/vid.html



top alphanumeric-index category-index





h4

The VID dialect has some defined styles (shortcuts). The styles h1 h2 h3

h4 h5 display text of a pre-defined size. The largest is h1. We have:



h1 - a text preset to font-size 32

h2 - a text preset to font-size 26

h3 - a text preset to font-size 22

h4 - a text preset to font-size 17

h5 - a text preset to font-size 13



Here is an example:



h1 "Biggest Text Heading"

message: h3 "Medium-sized yellow heading..." yellow





http://www.red-by-example.org/vid-text-faces-red.html



There is an introduction to VID at:



http://www.red-by-example.org/vid.html



top alphanumeric-index category-index





h5

The VID dialect has some defined styles (shortcuts). The styles h1 h2 h3

h4 h5 display text of a pre-defined size. The largest is h1. We have:



h1 - a text preset to font-size 32

h2 - a text preset to font-size 26

h3 - a text preset to font-size 22

h4 - a text preset to font-size 17

h5 - a text preset to font-size 13



Here is an example:



h1 "Biggest Text Heading"

message: h3 "Medium-sized yellow heading..." yellow





http://www.red-by-example.org/vid-text-faces-red.html



There is an introduction to VID at:



http://www.red-by-example.org/vid.html



top alphanumeric-index category-index





handle!

A handle! datatype will be used in the future for opaque OS handles for

graphical objects.

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





handle?

USAGE:

HANDLE? value



DESCRIPTION:

Returns true if the value is this type.

HANDLE? is a function! value.



ARGUMENTS:

value [any-type!]





A handle! datatype will be used in the future for opaque OS handles for

graphical objects.



(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





hidden

Look in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





hint

Displays a hint message if a field is empty, which disappears

when an entry is made.



Argument



a string!





view [

title "Demo Window"

b1: button "Hello"

b2: button "Goodbye"

return

t1: field hint "Enter name" ;-- hint if nothing entered

]



top alphanumeric-index category-index





image

This is a VID style. It is a base type, but with a default size of

100x100. It expects an image option.



The default event is on-down



There is a complete VID example in:



http://www.red-by-example.org/vid-misc-faces-red.html



There is an introduction to VID at:



http://www.red-by-example.org/vid.html



top alphanumeric-index category-index





image!



(Awaiting additional documentation by red-by-example team.)

Values of this datatype contain a series! of RGBA values, which represent

pixels in a 2D image. Consult the official Red documentation at:





https://doc.red-lang.org/en/datatypes/image.html



top alphanumeric-index category-index





image?

USAGE:

IMAGE? value



DESCRIPTION:

Returns true if the value is this type.

IMAGE? is a function! value.



ARGUMENTS:

value [any-type!]



See image!



top alphanumeric-index category-index





insert-event-func

See the official View documents:

https://doc.red-lang.org/en/view.html



top alphanumeric-index category-index





italic

Look in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





ivory

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



It is a tuple! of value 255.255.240



view [

text 100x50 ivory " "

]







top alphanumeric-index category-index





khaki

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



It is a tuple! of value 179.179.126



view [

text 100x50 khaki " "

]







top alphanumeric-index category-index





layout

USAGE:

LAYOUT spec



DESCRIPTION:

Return a face with a pane built from a VID description.

LAYOUT is a function! value.



ARGUMENTS:

spec [block!] "Dialect block of styles, attributes, and layouts."



REFINEMENTS:

/tight => Zero offset and origin.

/options =>

user-opts [block!] "Optional features in [name: value] format."

/flags =>

flgs [block! word!] "One or more window flags."

/only => Returns only the pane block.

/parent =>

panel [object!]

divides [integer! none!]

/styles => Use an existing styles list.

css [block!] "Styles list.

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





leaf

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



It is a tuple! of value 0.128.0



view [

text 100x50 leaf " "

]







top alphanumeric-index category-index





left

Look in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





linen

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



It is a tuple! of value 250.240.230



view [

text 100x50 linen " "

]







top alphanumeric-index category-index





link-sub-to-parent

USAGE:

LINK-SUB-TO-PARENT face type old new



DESCRIPTION:

Internal Use Only.

LINK-SUB-TO-PARENT is a function! value.



ARGUMENTS:

face [object!]

type [word!]

old

new

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





link-tabs-to-parent

USAGE:

LINK-TABS-TO-PARENT face



DESCRIPTION:

Internal Use Only.

LINK-TABS-TO-PARENT is a function! value.



ARGUMENTS:

face [object!]



REFINEMENTS:

/init => Force /show of first tab.

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





loose

Look in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





magenta

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



It is a tuple! of value 255.0.255



view [

text 100x50 magenta " "

]







top alphanumeric-index category-index





make-face

USAGE:

MAKE-FACE style



DESCRIPTION:

Make a face from a given style name or example face.

MAKE-FACE is a function! value.



ARGUMENTS:

style [word!] "A face type."



REFINEMENTS:

/spec =>

blk [block!] "Spec block of face options expressed in VID."

/offset =>

xy [pair!] "Offset of the face."

/size =>

wh [pair!] "Size of the face."

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





maroon

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



It is a tuple! of value 128.0.0



view [

text 100x50 maroon " "

]







top alphanumeric-index category-index





metrics?

USAGE:

METRICS? face type



DESCRIPTION:

Returns a pair! value in the type metrics for the argument face.

METRICS? is a function! value.



ARGUMENTS:

face [object!] "Face object to query."

type [word!] "Metrics type: 'paddings or 'margins."



REFINEMENTS:

/total => Return the addition of metrics along an axis.

axis [word!] "Axis to use for addition: 'x or 'y."

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





middle

Look in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





mint

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



It is a tuple! of value 100.136.116



view [

text 100x50 mint " "

]







top alphanumeric-index category-index





navy

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



It is a tuple! of value 0.0.128



view [

text 100x50 navy " "

]







top alphanumeric-index category-index





no-wrap

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

offset-to-caret

USAGE:

OFFSET-TO-CARET face pt



DESCRIPTION:

Given a coordinate, returns the corresponding caret position.

OFFSET-TO-CARET is a function! value.



ARGUMENTS:

face [object!]

pt [pair!]



RETURNS:

[integer!]

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





offset-to-char

USAGE:

OFFSET-TO-CHAR face pt



DESCRIPTION:

Given a coordinate, returns the corresponding character position.

OFFSET-TO-CHAR is a function! value.



ARGUMENTS:

face [object!]

pt [pair!]



RETURNS:

[integer!]

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





offset?

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

oldrab

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



It is a tuple! of value 72.72.16



view [

text 100x50 oldrab " "

]







top alphanumeric-index category-index





olive

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



It is a tuple! of value 128.128.0



view [

text 100x50 olive " "

]







top alphanumeric-index category-index





on-alt-down

See 'Actors' in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





on-alt-up

See 'Actors' in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





on-aux-down

See 'Actors' in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





on-aux-up

See 'Actors' in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





on-change

See 'Actors' in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





on-click

See 'Actors' in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





on-close

See 'Actors' in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





on-create

See 'Actors' in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





on-dbl-click

See 'Actors' in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





on-detect

See 'Actors' in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





on-down

See 'Actors' in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





on-drag

See 'Actors' in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





on-drag-start

See 'Actors' in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





on-drop

See 'Actors' in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





on-enter

See 'Actors' in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





on-face-deep-change*

See 'Actors' in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





on-focus

See 'Actors' in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





on-key

See 'Actors' in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





on-key-down

See 'Actors' in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





on-key-up

See 'Actors' in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





on-menu

See 'Actors' in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





on-mid-down

See 'Actors' in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





on-mid-up

See 'Actors' in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





on-move

See 'Actors' in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





on-moving

See 'Actors' in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





on-over

See 'Actors' in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





on-pan

See 'Actors' in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





on-parse-event

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

on-press-tap

See 'Actors' in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





on-resize

See 'Actors' in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





on-resizing

See 'Actors' in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





on-rotate

See 'Actors' in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





on-select

See 'Actors' in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





on-time

See 'Actors' in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





on-two-tap

See 'Actors' in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





on-unfocus

See 'Actors' in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





on-up

See 'Actors' in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





on-zoom

See 'Actors' in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





orange

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



It is a tuple! of value 255.150.10



view [

text 100x50 orange " "

]







top alphanumeric-index category-index





origin

Look in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





overlap?

Look in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





pad

Look in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





panel

A panel is a container for other faces. We supply a block of faces.

The default event is on-down



In VID, here is a black panel containing 2 buttons:



panel1: panel black [

panel1-b1: button "panel1-b1" [mytext/text: "panel1-b1 clicked" ]

panel1-b2: button "panel1-b2" [mytext/text: "panel1-b2 clicked" ]

]



There is a complete VID example in:



http://www.red-by-example.org/vid-choice-faces-red.html



There is an introduction to VID at:



http://www.red-by-example.org/vid.html



Its official View documentation is at:



https://doc.red-lang.org/en/view.html#_panel



top alphanumeric-index category-index





papaya

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



It is a tuple! of value 255.80.37



view [

text 100x50 papaya " "

]







top alphanumeric-index category-index





para

Look in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





pewter

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



It is a tuple! of value 170.170.170



view [

text 100x50 pewter " "

]







top alphanumeric-index category-index





pink

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



It is a tuple! of value 255.164.200



view [

text 100x50 pink " "

]







top alphanumeric-index category-index





progress

This type represents a horizontal or vertical progress bar.



The default orientation is horizontal, because the default size for faces

is wider than its height. For a vertical slider, specify a size that is

taller than its width.



The optional value for the initial position can be a percent, or a float

between 0.0 and 1.0.



The default event is on-change



Its current value is available in 'data'.



There is a complete VID example in:



http://www.red-by-example.org/vid-misc-faces-red.html



There is an introduction to VID at:



http://www.red-by-example.org/vid.html



Its official View documentation is at:



https://doc.red-lang.org/en/view.html#_progress





top alphanumeric-index category-index





purple

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



It is a tuple! of value 128.0.128



view [

text 100x50 purple " "

]







top alphanumeric-index category-index





radio

A radio provides a radio-button, with an optional label. Only one radio

button per panel is allowed to be on.



The default event-handler is on-change, and the boolean state exists in

'data'.



Here is a VID example with 3 radios labelled "Big", "Small", "Medium".

Changing any of them results is the 3 states being printed.



panel2: panel orange [ ;-- orange panel, 3 radios

panel2-r1: radio "Big"

[print ["radios: " panel2-r1/data panel2-r2/data panel2-r3/data]]

panel2-r2: radio "Small"

[print ["radios: " panel2-r1/data panel2-r2/data panel2-r3/data]]

panel2-r3: radio "Medium"

[print ["radios: " panel2-r1/data panel2-r2/data panel2-r3/data]]

]





There is a complete VID example in:



http://www.red-by-example.org/vid-choice-faces-red.html



There is an introduction to VID at:



http://www.red-by-example.org/vid.html



Its official View documentation is at:



https://doc.red-lang.org/en/view.html#_radio



top alphanumeric-index category-index





rate

Look in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





react

See the official VID documents:

https://doc.red-lang.org/en/vid.html



top alphanumeric-index category-index





reblue

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



It is a tuple! of value 38.58.108



view [

text 100x50 reblue " "

]







top alphanumeric-index category-index





rebolor

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



It is a tuple! of value 142.128.110



view [

text 100x50 rebolor " "

]







top alphanumeric-index category-index





red

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



It is a tuple! of value 255.0.0



view [

text 100x50 red " "

]







top alphanumeric-index category-index





remove-event-func

See the official View documents:

https://doc.red-lang.org/en/view.html



top alphanumeric-index category-index





remove-event-func

See the official View documents:

https://doc.red-lang.org/en/view.html



top alphanumeric-index category-index





remove-reactor

See the official View documents:

https://doc.red-lang.org/en/view.html



top alphanumeric-index category-index





request-dir

Causes a dialog to appear asking the user to select a directory, and returns

the full directory path as a file! type, or a block of paths.

It returns none if no selection is made. The title bar shows:

'Browse For Folder'

It works in a Red GUI program, and also in a non-GUI console program.



There are no arguments.



Refinements

/title - to be displayed under the title bar. We provide a string!



/dir - Set starting directory. We provide a name, which can be a

string! or file!.



/filter - To Be Developed: Block of filters (filter-name filter):

a block!



/keep - Keep previous directory path



/multi - To Be Developed: Allows multiple file selection, returned as

a block.





; -------------------------------------------------------------------------

; Use request-dir from the Red console, on Windows

; -------------------------------------------------------------------------



red>> choice: request-dir

;user browsed to c:\mike\ALBUM\ Note the %, indicating a file!

red>> choice

== %/C/ALBUM/



; -------------------------------------------------------------------------

; /dir and /title refinements

; -------------------------------------------------------------------------



;add a title, and start with C:/mike selected

red>> print request-dir/title/dir "Choose Dir" "C:\mike"

== %/C/Mike/data/



top alphanumeric-index category-index





request-file

Causes a dialog to appear asking the user to select a file, and

returns the full file path as a file! type, or block of paths.

It returns none if no selection is made. 'Open' is displayed

as the default title. It works in a Red GUI app, and also in a

non-GUI console app.



There are no arguments



Refinements

/title - window title. We supply a string!



/file - Default file name or directory. We supply a name as

a string! or file!.



/filter - supply a block of filters consisting of pairs of filter

names, and the actual filters.



/save - File save mode.



/multi - Allows multiple file selection, returned as a block.





; -------------------------------------------------------------------------

; request-file examples

; -------------------------------------------------------------------------



;display an 'open' dialog, on Windows

red>> choice: request-file

;note the file! type result

red>> choice

== %/C/red/try-demos.red



; -------------------------------------------------------------------------

; /filter refinement .jpg, .red

; -------------------------------------------------------------------------



red>> print request-file/filter ["jpegs" "*.jpg" "Red files" "*.red"]



top alphanumeric-index category-index





request-font

Causes a dialog to appear asking the user to select a font, and returns

a font! object!, or none if no selection is made.

It works in a Red GUI program, and also in a non-GUI console program.



There are no arguments



Refinements



/mono - Show monospaced font only.





; -------------------------------------------------------------------------

; request-font examples

; -------------------------------------------------------------------------



;display the dialog. The Dayton font is selected by the user here

red>> choice: request-font



;note the result

red>> print choice

name: "Dayton"

size: 11

style: none

angle: 0

color: none

anti-alias?: false

shadow: none

state: none

parent: none



;and it is an object

red>> type? choice

== object!



top alphanumeric-index category-index





return

The VID dialect word return is used to position the next GUI

elements from the left side of the window.



Red [

needs: 'view

]



view [

across

text "Line 1"

text "Line 2"

return

text "Line 3"

]







top alphanumeric-index category-index





rich-text

view

[ ;-- show a rich text face, with differing font size, colors

out-rich: rich-text 300x100 data [

i b "Hello" /b font 24 red " Red " /font blue "World!" /i

]

]



top alphanumeric-index category-index





right

Look in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





rtd-layout

USAGE:

RTD-LAYOUT spec



DESCRIPTION:

Returns a rich-text face from a RTD source code.

RTD-LAYOUT is a function! value.



ARGUMENTS:

spec [block!] "RTD source code."



REFINEMENTS:

/only => Returns only [text data] facets.

/with => Populate an existing face object.

face [object!] "Face object to populate."



RETURNS:

[object! block!]

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





screen

Represents a graphic display unit connected to the computer (usually a

monitor).



Its official View documentation is at:



https://doc.red-lang.org/en/view.html#_screen



top alphanumeric-index category-index





select

Look in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





set-flag

USAGE:

SET-FLAG face facet value



DESCRIPTION:

Sets a flag in a face object.

SET-FLAG is a function! value.



ARGUMENTS:

face [object!]

facet [word!]

value [any-type!]

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





set-focus

USAGE:

SET-FOCUS face



DESCRIPTION:

Sets the focus on the argument face.

SET-FOCUS is a function! value.



ARGUMENTS:

face [object!]

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





show

See the official View documents:

https://doc.red-lang.org/en/view.html



top alphanumeric-index category-index





sienna

The VID dialect provides named colors. Each color has a tuple! value.



For example, here we create a brown text element:



view [

text 100x50 brown " "

]





top alphanumeric-index category-index





silver

The VID dialect provides named colors. Each color has a tuple! value.



For example, here we create a brown text element:



view [

text 100x50 brown " "

]





top alphanumeric-index category-index





size-text

In system/words, sometimes used in rich-text programming.



(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





sky

The VID dialect provides named colors. Each color has a tuple! value.



For example, here we create a brown text element:



view [

text 100x50 brown " "

]





top alphanumeric-index category-index





slider

This type represents a cursor which can be moved along a horizontal or

vertical axis. The optional value for the initial position can be a

percent, or a float between 0.0 and 1.0.



Its default event is: on-change



Its current value is available in 'data'.



The default orientation is horizontal, because the default size for

faces is wider than its height. For a vertical slider, specify a

size that is taller than its width.



Here is VID example where a slider's value is displayed in a text

and used to control a progress bar. Note the use of 'face' to

represent the current face. We could also have written 'slider1'.



slider1: slider 20x100 50% [ ;--vertical, initially at middle

mytext/text: face/data

progress1/data: face/data

]



There is a complete VID example in:

http://www.red-by-example.org/vid-misc-faces-red.html



There is an introduction to VID at:

http://www.red-by-example.org/vid.html



Its official View documentation is at:

https://doc.red-lang.org/en/view.html#_slider





top alphanumeric-index category-index





snow

The VID dialect provides named colors. Each color has a tuple! value.



For example, here we create a brown text element:



view [

text 100x50 brown " "

]





top alphanumeric-index category-index





space

Changes the default spacing between faces.



Argument



a pair!





view [

size 300x200

title "Demo Window"

space 100x70 ;-- bigger horizontal/vertical spacing

b1: button "Hello"

b2: button "Goodbye"

return

]



top alphanumeric-index category-index





style

Look in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





tab-panel

A collection of panels, only one is visible at a time. We supply a block

of strings for the tabs.



The default event is: on-select.



Here is a VID example, with 3 tabs:



tab-panel 250x120 [

"Tab A" [h4 "In a tab!" button "Click in A" [print "A"] ]

"Tab B" [button "Click in B" [print "B"] ]

"Tab C" [button "Click in C" [print "C"] ]

]



There is a complete VID example in:



http://www.red-by-example.org/vid-misc-faces-red.html



There is an introduction to VID at:



http://www.red-by-example.org/vid.html



Its official View documentation is at:



https://doc.red-lang.org/en/view.html#_tab_panel





top alphanumeric-index category-index





tanned

The VID dialect provides named colors. Each color has a tuple! value.



For example, here we create a brown text element:



view [

text 100x50 brown " "

]





top alphanumeric-index category-index





teal

The VID dialect provides named colors. Each color has a tuple! value.



For example, here we create a brown text element:



view [

text 100x50 brown " "

]





top alphanumeric-index category-index





text

This face is used to display text data on-screen. The data can be

changed later, e.g. by:



text-my-name/text: "Jimi"



There are also h1 h2 h3 h4 h5, which provide a

slightly shorter way of creating text with common font-sizes, as in:



h1: "Very big heading"

h5: "Small heading"



We cannot key-in data to a text - use the field for this.



Here is a VID example with a yellow text and a button. When we

click it, the text displays "Goodbye!":



view [

message: text yellow "Hello!" ;-- yellow, with initial string

button "Press Me" [message/text: "Goodbye!"] ;-- change it

]



There is a complete VID example in:



http://www.red-by-example.org/vid-text-faces-red.html



There is an introduction to VID at:



http://www.red-by-example.org/vid.html



Its official View documentation is at:



https://doc.red-lang.org/en/view.html#_text





top alphanumeric-index category-index





text-list



This type represents a vertical list of text strings, displayed in a

fixed frame. A vertical scrollbar appears automatically if the content

does not fit the frame.



The drop-down, drop-list, and text-list are related.

The default event-handler is on-change



'selected' provides the position of the selection. This is -1 if no

selection exists.



In VID:



days-text-list1: text-list pink 90x110 data [

"Monday" "Tuesday" "Wednesday" "Thursday"

]



We can choose to preset an initial selection like this:



days-text-list: text-list pink 90x110 select 2 ;-- 2 refers to

"Tuesday"

data [

"Monday" "Tuesday" "Wednesday" "Thursday"

]



There is a complete VID example in:



http://www.red-by-example.org/vid-choice-faces-red.html



There is an introduction to VID at:



http://www.red-by-example.org/vid.html



Its official View documentation is at:



https://doc.red-lang.org/en/view.html#_text_list





top alphanumeric-index category-index





title

Sets the container title.



Argument



A string!





view [

;-- set title for window

backdrop green

size 300x200

title "Demo Window" ;-- title of window

b1: button "Hello"

b2: button "Goodbye"

return

]



top alphanumeric-index category-index





top

Look in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





transparent

The VID dialect provides named colors. Each color has a tuple! value.



For example, here we create a brown text element:



view [

text 100x50 brown " "

]





top alphanumeric-index category-index





underline

Look in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





unview

USAGE:

UNVIEW



DESCRIPTION:

Close last opened window view.

UNVIEW is a function! value.



REFINEMENTS:

/all => Close all views.

/only => Close a given view.

face [object!] "Window view to close."



(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





view

The function view is used to:

- declare a GUI layout using VID

- invoke that GUI layout



Red [

needs: 'view

]



view [

below

text "Line 1"

text "Line 2"

]



top alphanumeric-index category-index





violet

The VID dialect provides named colors. Each color has a tuple! value.



For example, here we create a brown text element:



view [

text 100x50 brown " "

]





top alphanumeric-index category-index





water

The VID dialect provides named colors. Each color has a tuple! value.



For example, here we create a brown text element:



view [

text 100x50 brown " "

]





top alphanumeric-index category-index





wheat

The VID dialect provides named colors. Each color has a tuple! value.



For example, here we create a brown text element:



view [

text 100x50 brown " "

]





top alphanumeric-index category-index





white

The VID dialect provides named colors. Each color has a tuple! value.



For example, here we create a brown text element:



view [

text 100x50 brown " "

]





top alphanumeric-index category-index





window

Represents a window displayed on the OS desktop.



In VID the window is made large enough to hold all the faces, but we

can also choose our own fixed size.

The View Engine provides more facilities - such as handling a

window-resize event, and adding a menu bar.

In VID we can define a window like this:

view [

size 350x450 ;-- window size

title "Text faces" ;-- window title



t1: text "Hello" ;-- rest of VID code

;-- etc

]



Its official View documentation is at:



https://doc.red-lang.org/en/view.html#_window



top alphanumeric-index category-index





with

Evaluates a block of Red code bound to the currently defined face. Allows

directly setting the face fields, overriding other VID options.



Note that the with is executed as the face is created. In the following,

if we reversed the order of b1 and b2, creating b2 first, an error would

result, because b1 does not exist (yet).





view [

b1: button "Hello" ;-- actually shows "HI!"

b2: button "Goodbye" with [b1/text: "HI!"]

]



top alphanumeric-index category-index





wrap

Look in the official VID documents:

https://doc.red-lang.org/en/vid.html

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





yello

The VID dialect provides named colors. Each color has a tuple! value.



For example, here we create a brown text element:



view [

text 100x50 brown " "

]





top alphanumeric-index category-index





yellow

The VID dialect provides named colors. Each color has a tuple! value.



For example, here we create a brown text element:



view [

text 100x50 brown " "

]





top alphanumeric-index category-index





copy

Consult the Parse dialect page for information.



top alphanumeric-index category-index





skip

Consult the Parse dialect page for information.



top alphanumeric-index category-index





box

Consult the Draw pages for information.



top alphanumeric-index category-index





fill-pen

Consult the Draw pages for information.



top alphanumeric-index category-index





line

Consult the Draw pages for information.



top alphanumeric-index category-index





pen

Consult the Draw pages for information.



top alphanumeric-index category-index





<

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



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





<<

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.



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





<=

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



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





<>

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.



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





=

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



2 = 3

== false



2 = 2.0

== true



22-03-2000 = 14-04-2012

== false



"ABC" = "abc"

== true



top alphanumeric-index category-index





==

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



2 == 3

== false



2 == 2.0

== false



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

== false



"ABC" == "abc"

== false



top alphanumeric-index category-index





=?

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.



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





>

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



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





>=

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



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





>>

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.



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





>>>

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.



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





?

This word is a synonym for help

??

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



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





a-an

USAGE:

A-AN str



DESCRIPTION:

Returns the appropriate variant of a or an (simple, vs 100% grammatically correct).

A-AN is a function! value.



ARGUMENTS:

str [string!]



REFINEMENTS:

/pre => Prepend to str.



; -------------------------------------------------------------------------

; a-an

; -------------------------------------------------------------------------



>> a-an "apple"

== "an"

>> a-an "chair"

== "a"



top alphanumeric-index category-index





about

Displays the version of Red currently in use



Has no parameters



absolute

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



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





acos

This word is a synonym for arccosine

action!

The datatype! action! encompassess a specific set of native!

functions.



; -------------------------------------------------------------------------

; 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





action?

The word action? returns true if its argument is an action!

type, or false otherwise.



red>> action? :take ; Colon is mandatory to get to function definition

== true



top alphanumeric-index category-index





add

The word add adds 2 values together.

This is equivalent to the infix operator +.



Has 2 operands, which can be expressions or values



; -------------------------------------------------------------------------

; 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





alert

docstart

USAGE:

ALERT msg



DESCRIPTION:

ALERT is a function! value.



ARGUMENTS:

msg [string! block!]

.docend



Displays a pop-up notification box, with a message and an OK button.



The program waits, and continues when OK is clicked, or the 'enter' key is pressed.







alert "Hello"

alert ["Year is " 2022]





top alphanumeric-index category-index





all

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.



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





all-word!

all-word?

all-word? returns true if its argument is any all-word! type.



It has no refinements.



Examples

; -------------------------------------------------------------------------

; Try block, word, and /refinement

; -------------------------------------------------------------------------



>> all-word? [1 2]

== false

>> all-word? 'find

== true

>> all-word? first [find]

== true

>> all-word? /ref

== true



top alphanumeric-index category-index





also

The word also first evaluates its first argument and then

also evaluates its second argument.



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





alter

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.



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





and

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.



; -------------------------------------------------------------------------

; 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





and~

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.



; -------------------------------------------------------------------------

; 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





any

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.



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





any-block!

ANY-BLOCK! is a typeset! value: make typeset! [block! paren! path! lit-path!

set-path! get-path! hash!]







top alphanumeric-index category-index





any-block?

USAGE:

ANY-BLOCK? value



DESCRIPTION:

Returns true if the value is any type of any-block.

ANY-BLOCK? is a function! value.



ARGUMENTS:

value [any-type!]



; -------------------------------------------------------------------------

; any-block? Examples

; -------------------------------------------------------------------------



>> any-block? [1 2]

== true

>> any-block? "234"

== false

>> any-block? first [ (1 2 3)]

== true



top alphanumeric-index category-index





any-function!

ANY-FUNCTION! is a typeset! value: make typeset! [native! action! op! function! routine!]



top alphanumeric-index category-index





any-function?

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



It has no refinements.



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





any-list!

The word any-list! is a typeset! of value: [block! paren! hash!].



We can test if any item is an any-list! with the any-list? function



red>> any-list!

== make typeset! [block! paren! hash!]



red>> a: [1 2 3]

== [1 2 3]



red>> any-list? a

== true



red>> any-list? 3

== false



top alphanumeric-index category-index





any-list?

The word any-list? returns true if its argument is an any-list! type,

otherwise false.



An any-list! is a typeset! of:

block! paren! hash!



Its argument can be of any type.



; -------------------------------------------------------------------------

; try some types with any-list?

; -------------------------------------------------------------------------



red>> any-list? "text"

false



red>> any-list? 127.33.63

== false



red>> any-list? [22 33]

== true



red>> any-list? (2 3)

== false



red>> any-list? (2 3) ; invalid - Red tries to evaluate the argument

== false



red>> first [(2 3)] ; valid - [ ] prevents evaluation

== (2 3)



red>> any-list? first [(2 3)] ; now it works!

== true



top alphanumeric-index category-index





any-object!

any-object?

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



It has no refinements.



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





any-path!

Is a typeset!

make typeset! [path! lit-path! set-path! get-path!]



See any-path?



top alphanumeric-index category-index





any-path?

The word any-path? returns true if its argument is a valid path! variant.

Otherwise false.



In Red, there are several types of path! like:

path! lit-path! set-path! get-path!



For more details on the ways of interpreting a word (involving ' and :),

the reader should look at the lit-word!, get-word! and set-word! docs.



; -------------------------------------------------------------------------

; Standard paths. Note: we use a [block] to prevent evaluation

; -------------------------------------------------------------------------



red>> any-path? first [a/b/c]

== true



red>> path? first [a/b/c]

== true



red>> type? first [a/b/c]

== path!



red>> any-path? first [a / b] ; Surprise - it is a division!

== false



; -------------------------------------------------------------------------

; Set paths.

; -------------------------------------------------------------------------



red>> any-path? first[a/b:]

== true



red>> set-path? first[a/b:]

== true



red>> type? first[a/b:]

== set-path!



red>> type? first[a:/b/c] ; Surprise - because of colon in 2nd position!

== url!



red>> any-path? first [a:/b/c]

== false



; -------------------------------------------------------------------------

; Get paths.

; -------------------------------------------------------------------------



red>> any-path? first [:a/b/c]

== true



red>> get-path? first [:a/b/c]

== true



red>> type? first [:a/b/c]

== get-path!



; -------------------------------------------------------------------------

; Lit paths.

; -------------------------------------------------------------------------



red>> any-path? first ['a/b/c]

== true



red>> lit-path? first ['a/b/c]

== true



red>> type? first ['a/b/c]

== lit-path!



top alphanumeric-index category-index





any-string!

Is a typeset!

make typeset! [string! file! url! tag! email!]



See any-string?



top alphanumeric-index category-index





any-string?

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.



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





any-type!

any-word!

any-word?

The word any-word? returns true if its argument can be any-word!.



It has no refinements.



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





append

The word append inserts value(s) at the end of a series!

and returns the head of the series. The original series is changed.



Arguments:

1. the series to be extended can be any series a bitmap! or a map!

2. the value to be appended can be any-type!



Refinements

/part - limit the number of values inserted. (a number! or a series index)

/only - insert block types as single values (overrides /part).

/dup - duplicate the inserted values. Provide a number!



; -------------------------------------------------------------------------

; Append to a block!

; -------------------------------------------------------------------------



red>> a-block: [1 2 3 "four" 5]

== [1 2 3 "four" 5]



red>> append a-block 6

== [1 2 3 "four" 5 6]



red>> append a-block [7 8 "nine" [10 11]]

== [1 2 3 "four" 5 6 7 8 "nine" [10 11]]



; -------------------------------------------------------------------------

; Append to a string!

; -------------------------------------------------------------------------



red>> a-string: "ABCD"

== "ABCD"



red>> append a-string "123"

== "ABCD123"



red>> append a-string [6 5 4]

== "ABCD123654" ; see what happens here?



; -------------------------------------------------------------------------

; /part refinement

; -------------------------------------------------------------------------



red>> series-1: [1 2 3 4 5 6]

== [1 2 3 4 5 6]



red>> series-2: [100 200 300 400 500]

== [100 200 300 400 500]



red>> append/part series-1 series-2 3

== [1 2 3 4 5 6 100 200 300] ; only 3 items appended



; -------------------------------------------------------------------------

; /only refinement

; -------------------------------------------------------------------------



red>> series-1: [1 2 3 4 5 6]

== [1 2 3 4 5 6]



red>> series-2: [100 200 300 400 500]

== [100 200 300 400 500]



red>> append/only series-1 series-2

== [1 2 3 4 5 6 [100 200 300 400 500]] ; appended as a comnplete block



; -------------------------------------------------------------------------

; /dup refinement - note duplicated values at end

; -------------------------------------------------------------------------



red>> series-1: [1 2 3 4 5 6]

== [1 2 3 4 5 6]



red>> series-2: [100 200]

== [100 200]



red>> append/dup series-1 series-2 3

== [1 2 3 4 5 6 100 200 100 200 100 200]



top alphanumeric-index category-index





arccosine

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.



arcsine

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.



arctangent

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.



arctangent 0

== 0.0



arctangent/radians 0

== 0.0



top alphanumeric-index category-index





arctangent2

USAGE:

ARCTANGENT2 y x



DESCRIPTION:

Returns the smallest angle between the X axis and the point (x,y) (-pi to pi).

ARCTANGENT2 is a native! value.



ARGUMENTS:

y [number!]

x [number!]



RETURNS:

[float!]

(Awaiting additional documentation by red-by-example team.)



top alphanumeric-index category-index





as

USAGE:

AS type spec



DESCRIPTION:

Coerce a series into a compatible datatype without copying it.

AS is a native! value.



ARGUMENTS:

type [datatype! block! paren! any-path! any-string!] "The datatype

or example value."

spec [block! paren! any-path! any-string!] "The series to coerce."





; -------------------------------------------------------------------------

; as examples

; -------------------------------------------------------------------------



>> b: [1 2 3]

== [1 2 3]

>> p: as paren! b

== (1 2 3)

>> b

== [1 2 3] ;-- nb unchanged





top alphanumeric-index category-index





as-color

The word as-color generates a tuple! with R, G and B values

from its 3 integer! arguments.



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





as-ipv4

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.



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





as-pair

The word as-pair combines 2 integer! or float! values into a pair!.



; -------------------------------------------------------------------------

; Demonstrate mixed integers and floats, also truncation

; -------------------------------------------------------------------------



red>> as-pair 22 33

22x33



red>> as-pair 22 33.9

22x33



red>> as-pair 44.3 44.99

44x44



top alphanumeric-index category-index





as-rgba

USAGE:

AS-RGBA a b c d



DESCRIPTION:

Combine a, b, c and d values into a tuple.

AS-RGBA is a routine! value.



ARGUMENTS:

a [integer!]

b [integer!]

c [integer!]

d [integer!]



; -------------------------------------------------------------------------

; as-rgba

; -------------------------------------------------------------------------



>> as-rgba 255 0 255 1

== 255.0.255.1



top alphanumeric-index category-index





asin

This word is a synonym for arcsine

ask

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



answer: ask "What is your name?"

What is your name?Carl

== "Carl"



answer

== "Carl"



top alphanumeric-index category-index





at

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.



red>> at [1 2 3 4 5] 3

== [3 4 5]



red>> at "abcde" 3

== "cde"



red>>