;; remove value from front of list
(bind-func dequeue
(lambda (queue:|2,list_t*|*)
(let ((front (aref queue 0)))
(if (null? front) -1
(let ((val (tref front 0))
(back (aref queue 1)))
(aset! queue 0 (tref front 1))
(if (= back front) (aset! queue 1 null))
(free front)
val)))))