Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

array.int64

import array

Everything here is re-exported by array, so import array is enough and the names are called as array.*. Importing array.int64 on its own works too and reaches the same definitions.

Int64Array: a packed array of twos-complement 64-bit signed integers, 8 bytes per element.

INT64_MAX and INT64_MIN bound what an element may be; a value outside them raises rather than wrapping.

Constants

INT64_MAX

array.INT64_MAX: bigint

Maximum value that “should” exist in a list passed to Int64Array. Written with the explicit n bigint suffix since the bare literal 9223372036854775807 parses as a lossy number (a known, pre-existing limitation of plain integer literals at exactly i64::MAX: see tests/big-integer-literal-overflow.zu), 193 away from the true value.

INT64_MIN

array.INT64_MIN: bigint

Minimum value that “should” exist in a list passed to Int64Array.

Classes

Int64Array

class array.Int64Array < Array

class Int64Array represents an array of twos-complement 64-bit signed integers in the platform byte order.

Values at or beyond ±2^53 need Zuri’s bigint type to be represented exactly (a regular number is an IEEE-754 double, and loses precision past that point): append()/set() accept either a plain integer or a bigint (is_bigint()) for that reason.

  • printable — has a @to_string(), so echo and print() show something useful
  • serializable — has a @to_json(), so it can be handed straight to json.encode()
  • valueable — has a @to_value(), so it converts to a plain Zuri value

Int64Array.reverse()

array.Int64Array.reverse() -> Int64Array

Returns a new array containing the elements in the original array in reverse order.

Returns Int64Array

Int64Array.clone()

array.Int64Array.clone() -> Int64Array

Returns a new Int64Array containing all items from the current array. The new array is a shallow copy of the original array.

Returns Int64Array

Int64Array.slice()

array.Int64Array.slice(start, end) -> Int64Array

Returns a new Int64Array over [start, end) of this array (both default to the whole array; negative bounds count from the end).

Parameters

  • start (?number)
  • end (?number)

Returns Int64Array


2021, Richard Ore and Zuri contributors