potion
0.2
|
a tuple is an array of PNs. More...
#include <potion.h>
Data Fields | |
PN_OBJECT_HEADER | |
PNType vt; PNUniq uniq. More... | |
PN_SIZE | len |
PN_SIZE | alloc |
overallocate a bit More... | |
PN | set [] |
Extract slice copy of a tuple, similar to strings. Supports negative indices and end<start.
start | PNInteger. Default 0. If negative, count from end. If too large, return nil. |
end | PNInteger. Optional, default last index. If negative, count from end. If too large, return nil. |
"remove" an element at index from tuple.
destructively "delete" an element at index from tuple.
TODO: bitonic __m128 sort (SSE accelerated) for typed tuples E.g.
sort elements, safe non-destructive version. generic instable quicksort, via in-place quicksort partition algorithm.
compare | method cmp(a,b) => -1,0,1, or NIL for UNIQ (random, but stable), or true for ascending or false for descending order by value. true or false will fail on most complex data types, works only with num (ints). |
self | sort tuple |
cmp | cmp method for 2 values, returning -1,0,1 |
"ins_sort" method, used internally,
cmp | (optional) comparison closure: (a,b) a < b ? -1 : a == b ? 0 : 1. The default sort method is not by value, it is by uniq (random, but stable). |