Documentation ¶
Overview ¶
Package Range provides an efficient iterator over linear numeric sequences.
Index ¶
- Constants
- func At(vm *VM, target, locals *Object, msg *Message) *Object
- func Contains(vm *VM, target, locals *Object, msg *Message) *Object
- func First(vm *VM, target, locals *Object, msg *Message) *Object
- func Foreach(vm *VM, target, locals *Object, msg *Message) (result *Object)
- func Index(vm *VM, target, locals *Object, msg *Message) *Object
- func IndexOf(vm *VM, target, locals *Object, msg *Message) *Object
- func IoAddon() addon.Interface
- func Last(vm *VM, target, locals *Object, msg *Message) *Object
- func New(vm *VM, start, stop, step float64) *Object
- func Next(vm *VM, target, locals *Object, msg *Message) *Object
- func Previous(vm *VM, target, locals *Object, msg *Message) *Object
- func Rewind(vm *VM, target, locals *Object, msg *Message) *Object
- func SetIndex(vm *VM, target, locals *Object, msg *Message) *Object
- func SetRange(vm *VM, target, locals *Object, msg *Message) *Object
- func Size(vm *VM, target, locals *Object, msg *Message) *Object
- func Value(vm *VM, target, locals *Object, msg *Message) *Object
- type Range
Constants ¶
const RangeTag = iolang.BasicTag("github.com/zephyrtronium/iolang/addons/range")
RangeTag is the Tag for Range objects.
Variables ¶
This section is empty.
Functions ¶
func At ¶
func At(vm *VM, target, locals *Object, msg *Message) *Object
At is a Range method.
at returns the nth value of the range.
func Contains ¶
func Contains(vm *VM, target, locals *Object, msg *Message) *Object
Contains is a Range method.
contains returns true if the given value occurs exactly in the range.
func First ¶
func First(vm *VM, target, locals *Object, msg *Message) *Object
First is a Range method.
first moves the range's cursor to the beginning and returns its value.
func Foreach ¶
func Foreach(vm *VM, target, locals *Object, msg *Message) (result *Object)
Foreach is a Range method.
foreach performs a loop for each element of the range.
func Index ¶
func Index(vm *VM, target, locals *Object, msg *Message) *Object
Index is a Range method.
index returns the number of terms yielded from the range.
func IndexOf ¶
func IndexOf(vm *VM, target, locals *Object, msg *Message) *Object
IndexOf is a Range method.
indexOf returns the index of the range that would produce a particular value, or nil if none would.
func Last ¶
func Last(vm *VM, target, locals *Object, msg *Message) *Object
Last is a Range method.
last moves the range's cursor to the end and returns its value.
func New ¶
func New(vm *VM, start, stop, step float64) *Object
New creates a new Range object with the given start, stop, and step values.
func Next ¶
func Next(vm *VM, target, locals *Object, msg *Message) *Object
Next is a Range method.
next increments the range's cursor. Returns self if the cursor is still in bounds and nil otherwise.
func Previous ¶
func Previous(vm *VM, target, locals *Object, msg *Message) *Object
Previous is a Range method.
previous decrements the range's cursor. Returns self if the cursor is still in bounds and nil otherwise.
func Rewind ¶
func Rewind(vm *VM, target, locals *Object, msg *Message) *Object
Rewind is a Range method.
rewind returns the range to its first value and returns the range.
func SetIndex ¶
func SetIndex(vm *VM, target, locals *Object, msg *Message) *Object
SetIndex is a Range method.
setIndex seeks the range to a new index.
func SetRange ¶
func SetRange(vm *VM, target, locals *Object, msg *Message) *Object
SetRange is a Range method.
setRange sets the range to have the given start, stop, and step values.
Types ¶
type Range ¶
Range yields the terms of a linear sequence.
func (Range) Next ¶
Next computes the current range value and increments the cursor. If the value is in the range, then ok is true. Returns the new range value.