shithub: mc

ref: 076fef88db990fb1dd8f0650d018035755d0d45b
dir: /lib/std/slpop.myr/

View raw version
use "types"
use "alloc"

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

generic slpop = {sl
	var elt

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