Port Actors - r3n/rebol-wiki GitHub Wiki

The following page includes a list of actions that can be used as PORT/ACTORS and their description strings.

At this time, this list is not considered exhaustive.

Table of Contents

Port Actors

Object API

Close

Closes a port.

port [port!]

Create

Send port a create request.

port [port! file! url! block!]

Delete

Send port a delete request.

port [port! file! url! block!]

Modify

Change mode or control for port or file.

target [port! file!]
field [word! none!]
value

Open

Opens a port; makes a new port from a specification if necessary.

spec [port! file! url! block!]
/new {Create new file - if it exists, reset it (truncate)}
/read "Open for read access"
/write "Open for write access"
/seek "Optimize for random access"
/allow "Specifies protection attributes"
access [block!]

Query

Returns information about a port, file, or URL.

target [port! file! url! block!]
/mode "Get mode information"
field [word! none!] "NONE will return valid modes for port type"

Read

Read from a file, URL, or other port.

source [port! file! url! block!]
/part {Partial read a given number of units (source relative)}
length [number!]
/seek "Read from a specific position (source relative)"
index [number!]
/string {Convert UTF and line terminators to standard text string}
/lines "Convert to block of strings (implies /string)"

Rename

Rename a file.

from [port! file! url! block!]
to [port! file! url! block!]

Write

Writes to a file, URL, or port - auto-converts text strings.

destination [port! file! url! block!]
data [binary! string! block!] "Data to write (non-binary converts to UTF-8)"
/part "Partial write a given number of units"
length [number!]
/seek "Write at a specific position"
index [number!]
/append "Write data at end of file"
/allow "Specifies protection attributes"
access [block!]
/lines "Write each value in a block as a separate line"

State API

Open?

Returns TRUE if port is open.

port [port!]

Update

Updates external and internal states (normally after read/write).

port [port!]

Navigation API

At

Returns the series at the specified index.

series [series! gob! port!]
index [number! logic! pair!]

Back

Returns the series at its previous position.

series [series! gob! port!]

Head

Returns the series at its beginning.

series [series! gob! port!]

Head?

Returns TRUE if a series is at its beginning.

series [series! gob! port!]

Index?

Returns the current position (index) of the series.

series [series! gob! port! none!]
/xy "Returns index as an XY pair offset"

Length?

Returns the length (from the current position for series.)

series [series! port! map! tuple! bitset! object! gob! struct! any-word! none!]

Next

Returns the series at its next position.

series [series! gob! port!]

Past?

Returns TRUE if series is past its end.

series [series! gob! port!]

Skip

Returns the series forward or backward from the current position.

series [series! gob! port!]
offset [number! logic! pair!]

Tail

Returns the series just past its end.

series [series! gob! port!]

Tail?

Returns TRUE if series is at or past its end; or empty for other types.

series [series! gob! port! bitset! map!]

Content API

Append

Inserts element(s) at tail; for series, returns head.

series [series! port! map! gob! object! bitset!] "Any position (modified)"
value [any-type!] "The value to insert"
/part "Limits to a given length or position"
length [number! series! pair!]
/only {Only insert a block as a single value (not the contents of the block)}
/dup "Duplicates the insert a specified number of times"
count [number! pair!]

Change

Replaces element(s); returns just past the change.

series [series! gob! port!] "At position (modified)"
value [any-type!] "The new value"
/part {Limits the amount to change to a given length or position}
length [number! series! pair!]
/only {Only change a block as a single value (not the contents of the block)}
/dup "Duplicates the change a specified number of times"
count [number! pair!]

Clear

Removes elements from current position to tail; returns at new tail.

series [series! port! map! gob! bitset! none!] "At position (modified)"

Copy

Copies a series, object, or other value.

value [series! port! map! object! bitset! any-function!] "At position"
/part "Limits to a given length or position"
length [number! series! pair!]
/deep "Also copies series values within the block"
/types "What datatypes to copy"
kinds [typeset! datatype!]

Find

Searches for a value; for series returns where found, else none.

series [series! gob! port! bitset! typeset! object! none!]
value [any-type!]
/part "Limits the search to a given length or position"
length [number! series! pair!]
/only "Treats a series value as only a single value"
/case "Characters are case-sensitive"
/any "Enables the * and ? wildcards"
/with "Allows custom wildcards"
wild [string!] "Specifies alternates for * and ?"
/skip "Treat the series as records of fixed size"
size [integer!]
/last "Backwards from end of series"
/reverse "Backwards from the current position"
/tail "Returns the end of the series"
/match {Performs comparison and returns the tail of the match}

Insert

Inserts element(s); for series, returns just past the insert.

series [series! port! map! gob! object! bitset! port!] "At position (modified)"
value [any-type!] "The value to insert"
/part "Limits to a given length or position"
length [number! series! pair!]
/only {Only insert a block as a single value (not the contents of the block)}
/dup "Duplicates the insert a specified number of times"
count [number! pair!]

Pick

Returns the value at the specified position.

aggregate [series! map! gob! pair! date! time! tuple! bitset! port!]
index {Index offset, symbol, or other value to use as index}

Poke

Replaces an element at a given position.

series [series! port! map! gob! bitset!] "(modified)"
index {Index offset, symbol, or other value to use as index}
value [any-type!] "The new value (returned)"

Remove

Removes element(s); returns same position.

series [series! gob! port! bitset! none!] "At position (modified)"
/part "Removes multiple elements or to a given position"
length [number! series! pair! char!]

Select

Searches for a value; returns the value that follows, else none.

series [series! port! map! object! none!]
value [any-type!]
/part "Limits the search to a given length or position"
length [number! series! pair!]
/only "Treats a series value as only a single value"
/case "Characters are case-sensitive"
/any "Enables the * and ? wildcards"
/with "Allows custom wildcards"
wild [string!] "Specifies alternates for * and ?"
/skip "Treat the series as records of fixed size"
size [integer!]
/last "Backwards from end of series"
/reverse "Backwards from the current position"

Take

Removes and returns one or more elements.

series [series! port! gob! none!] "At position (modified)"
/part "Specifies a length or end position"
length [number! series! pair!]
/deep "Also copies series values within the block"
/last "Take it from the tail end"
⚠️ **GitHub.com Fallback** ⚠️