arrays

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package arrays contains functions for manipulating arrays.

Index

Constants

This section is empty.

Variables

View Source
var Scope = wdte.S().Map(map[wdte.ID]wdte.Func{
	"concat":     wdte.GoFunc(Concat),
	"sort":       wdte.GoFunc(Sort),
	"sortStable": wdte.GoFunc(SortStable),
	"stream":     wdte.GoFunc(Stream),
})

Scope is a scope containing the functions in this package.

Functions

func Concat added in v0.2.6

func Concat(frame wdte.Frame, args ...wdte.Func) wdte.Func

Concat is a WDTE function with the following signatures:

concat array ...
(concat array) ...

Returns an array containing the concatonation of all of its arguments, all of which should be arrays, in the order that they were passed to it. For example,

concat [3; 6] [2; 5]

returns

[3; 6; 2; 5]

func Sort added in v0.2.2

func Sort(frame wdte.Frame, args ...wdte.Func) wdte.Func

Sort is a WDTE function with the following signatures:

sort array less
(sort array) less
sort less array
(sort less) array

Returns a sorted copy of the given array sorted using the given less function. The less function should take two arguments and return true if the first argument should be sorted earlier in the array then the second. Unlike sortStable, the relative positions of equal elements are undefined in the new array.

func SortStable added in v0.2.2

func SortStable(frame wdte.Frame, args ...wdte.Func) wdte.Func

SortStable is a WDTE function with the following signatures:

sortStable array less
(sortStable array) less
sortStable less array
(sortStable less) array

Returns a sorted copy of the given array sorted using the given less function. The less function should take two arguments and return true if the first argument should be sorted earlier in the array then the second. Unlike sort, the relative positions of equal elements are preserved.

func Stream

func Stream(frame wdte.Frame, args ...wdte.Func) wdte.Func

Stream is a WDTE function with the following signature:

stream a

Returns a stream.Stream that iterates over the array a.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL