arrays

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2018 License: MIT Imports: 3 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{
	"append":     wdte.GoFunc(Append),
	"sort":       wdte.GoFunc(Sort),
	"sortStable": wdte.GoFunc(SortStable),
	"stream":     wdte.GoFunc(Stream),
})

Scope is a scope containing the functions in this package.

Functions

func Append added in v0.2.2

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

Append is a WDTE function with the following signatures:

append array val...
(append array) val...

Returns a copy of the given array with values appended to it.

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