Series

A series is a sequence of values with a position: blocks, strings, binaries, paths and the like. These functions move a series’ position, read and change what it holds, search it and sort it. A position is part of the value: next gives the same series one place further, and changing it changes it for every value that refers to it. See series.

length?

The number of values from the series’ position to its tail.

length? series
  • series (series! map! object!)

empty?

True if the series has nothing from its position on, or the map nothing at all.

empty? series
  • series (series! map!)

first

The first value of a series.

first series
  • series (any value)

second

The second value of a series.

second series
  • series (any value)

third

The third value of a series.

third series
  • series (any value)

fourth

The fourth value of a series.

fourth series
  • series (any value)

fifth

The fifth value of a series.

fifth series
  • series (any value)

last

The last value of a series.

last series
  • series (series!)

pick

The value at a position or key.

pick series index
  • series (any-value!)

  • index (any-value!)

poke

Sets the value at a position or key; gives the value.

poke series index value
  • series (any-value!)

  • index (any-value!)

  • value (any-value!)

put

Sets the value of a key; gives the value.

put series key value
  • series (map! object! block!)

  • key (any-value!)

  • value (any-value!)

next

The series one position on.

next series
  • series (series!)

back

The series one position back.

back series
  • series (series!)

head

The series at its first position.

head series
  • series (series!)

tail

The series just past its last value.

tail series
  • series (series!)

skip

The series moved on, or back, by an offset.

skip series offset
  • series (series!)

  • offset (integer!)

at

The series at a position, counted from where it is.

at series index
  • series (series!)

  • index (integer!)

index?

The position of the series, from 1.

index? series
  • series (series!)

head?

True if the series is at its head.

head? series
  • series (series!)

tail?

True if the series is at its tail.

tail? series
  • series (series!)

last?

True if the series has one value left.

last? series
  • series (series!)

single?

True if the series has one value left.

single? series
  • series (series!)

append

Puts a value at the tail of a series; gives the series at its head.

append series value
  • series (series!)

  • value (any-value!)

  • /part range (integer! series!): Put in only part of the value

  • /only: A block goes in as one value

  • /dup count (integer!): Put it in several times

insert

Puts a value where the series is; gives the series just after it.

insert series value
  • series (series!)

  • value (any-value!)

  • /part range (integer! series!): Put in only part of the value

  • /only: A block goes in as one value

  • /dup count (integer!): Put it in several times

change

Puts a value over what the series holds where it is; gives the series just after it.

change series value
  • series (series!)

  • value (any-value!)

  • /part range (integer! series!): Change this much of the series

  • /only: A block goes in as one value

  • /dup count (integer!): Put the value in several times

remove

Removes what the series holds where it is; gives the series.

remove series
  • series (series!)

  • /part range (integer! series!): Remove this much

clear

Removes everything from the series’ position to its tail.

clear series
  • series (series! map!)

copy

A copy of the series, map, object or bitset.

copy value
  • value (series! map! object! bitset!)

  • /part length (integer! series!)

  • /deep

take

Removes the value at the head of a series and returns it; none if there is none.

take series
  • series (series! none!)

  • /part length (integer!): Takes that many values, as a series of the same type

  • /last: Takes from the tail instead

  • /deep: Copies the series inside what is taken

reverse

Reverses the order of the values from the series’ position.

reverse series
  • series (series!)

  • /part length (integer! series!)

move

Moves a value, or a span of values, within a series; gives the series after it.

move source offset
  • source (series!): Changed

  • offset (integer!): How far to move it, or with /to where to

  • /part length (integer!): Move this many values

  • /skip size (integer!): The series is records of this size

  • /to: Offset is a position from the head

swap

Swaps the first values of two series; gives the first series.

swap a b
  • a (series!)

  • b (series!)

alter

Removes the value if the series has it, adds it if not; true if it was added.

alter series value
  • series (series!)

  • value (any value)

pad

Pads a string with spaces on the right (with /left, on the left) up to a length. Modifies it.

pad str n
  • str (string!)

  • n (integer!)

  • /left: Pads on the left, which aligns to the right

  • /with c (char!): Pads with another character

array

Makes a block of the size given, or of blocks for a block of sizes.

array size
  • size (integer! block!)

  • /initial value (any value): Fill it with this; a series is copied, a function called

find

Finds a value in a series; gives the series where it is, or none.

find series value
  • series (series! none! typeset! bitset!)

  • value (any-type!)

  • /part length (integer! series!): Look only this far

  • /only: A block is one value

  • /case: Capitals matter

  • /skip size (integer!): Look only at every so many

  • /last: Find the last one

  • /tail: Give the series just after it

  • /match: Only where the series is

  • /reverse: Look back from where the series is

  • /any: In a string, * is any run of characters and ? any one

  • /same: In a block, the very same value (same?), not an equal one

select

The value after the one found, or none.

select series value
  • series (series! map! object! none!)

  • value (any-type!)

  • /only

  • /case

  • /skip size (integer!)

  • /last

replace

Replaces the first (or with /all every) occurrence of a pattern in a series.

replace target pattern value
  • target (series!)

  • pattern (any value)

  • value (any value)

  • /all

sort

Sorts the series in place.

sort series
  • series (series!)

  • /case

  • /skip size (integer!)

  • /compare comparator (any-function! integer!)

  • /reverse

extract

Takes every so many values of a series: the first of each record.

extract series width
  • series (series!)

  • width (integer!): Size of each record

  • /index pos (integer!): Take this position of each record instead

remove-each

Removes the values of a series for which the block gives true.

remove-each 'word data body
  • 'word (word! block!)

  • data (series!)

  • body (block!)

map-each

A block of what the block gives for each value of a series.

map-each 'word data body
  • 'word (word! block!)

  • data (series!)

  • body (block!)

collect

Evaluates a block where keep adds values to a new block, and returns it.

collect body
  • body (block!)

join

Joins a value with another value, or with a reduced block.

join value rest
  • value (any value)

  • rest (any value)

unique

The values of the series, each once.

unique set
  • set (series!)

  • /case

union

The values that are in either series, each once.

union a b
  • a (series! bitset!)

  • b (series! bitset!)

  • /case

intersect

The values that are in both series.

intersect a b
  • a (series! bitset!)

  • b (series! bitset!)

  • /case

difference

The values that are in one series but not the other; of two dates, the time between them.

difference a b
  • a (series! date! bitset!)

  • b (series! date! bitset!)

  • /case

exclude

The values of the first series that are not in the second.

exclude a b
  • a (series! bitset!)

  • b (series! bitset!)

  • /case