shithub: mc

ref: 8eef2702d6533ca399758c38acedf0f086b93e13
dir: /lib/std/slpop.myr/

View raw version
use "types.use"
use "alloc.use"

pkg std =
	generic slpop	: (sl : @a[:] -> (@a, @a[:]))
;;

generic slpop = {sl
	var elt

	elt = sl[$ - 1]
	sl = slgrow(sl, sl.len - 1)
	-> (elt, sl)
}