Skip to main content

Set and bag


bequal(Bag x,Bag y)->Boolean

Do bags x and y contain the same elements?

concatagg(Bag b)->Charstring

Concatenate stringified elements in bag b

exclusive(Bag b)->Bag

Return the singleton objects in bag b

first(Bag b)->Object

Pick the first element in bag b (no order guarantees)

first_n(Bag b,Number n)->Object

Get the n first element in bag b (no order guarantees)

inject(Bag b,Object o)->Bag

Inject 'o' between elements in bag 'b'

iota(Integer l,Integer u)->Bag of Integer r

Same as range(l,u)

last(Bag b)->Object

Pick the last element in bag b (no order guarantees)

natural_numbers()->Bag of Integer i

The infinite set of all natural numbers i

remove_null(Bag b)->Bag

Remove all tuples containing null values in bag b

rowprops(Vector props,Vector vals)->Bag of (Object,Object)

Generate bag of pairs from elements in vectors props and vals

sample(Bag b,Integer s)->Bag

Sample s elements from bag b

section(Bag b,Number start,Number stop)->Bag

Sub-bag from position start to stop in bag b (no order guarantees)

tuples(Bag b)->Bag of Vector

The tuples in bag b as vectors

union(Bag x,Bag y)->Object

The union of bags x and y

unique(Bag b)->Bag

Remove duplicates in bag b