Circular buffers.
THIS LIBRARY WILL BE DELETED IN FAVOUR OF DEQUEUE AT SOME POINT IN THE FUTURE
copies data from one array to another. This assumes that the destination array is large enough to accommodate the data
swap_array buf len
copies the contents of buf
to a new array of length
len
and places that new data into the buffer
double the size of the buffer
half the size of the buffer
iter buf ~f
calls func on each buffer element starting with 0
like this: (func pos element)
iterr buf ~f
calls func on each buffer element starting with end
like this: (func pos element)
drop stuff from the end. equivalent to while cutoff > f (get buf (length buf - 1)) do drop_last buf; done but calls drop just once