shithub: mc

Download patch

ref: d4c21dfa1254208ac352246b3e36be1bde15a662
parent: e4a2b887047fc3aa9e8f53a434f15bf9ea8b4076
author: Ori Bernstein <ori@eigenstate.org>
date: Fri Apr 29 18:48:43 EDT 2016

Add sldel

--- a/lib/std/slput.myr
+++ b/lib/std/slput.myr
@@ -4,6 +4,7 @@
 
 pkg std =
 	generic slput	: (sl : @a[:], idx : size, elt : @a	-> @a[:])
+	generic sldel	: (sl : @a[:], idx : size	-> @a[:])
 ;;
 
 generic slput = {sl, idx, elt
@@ -17,4 +18,11 @@
 	;;
 	sl[idx] = elt
 	-> sl
+}
+
+generic sldel = {sl, idx
+	for var i = idx; i < sl.len - 1; i++
+		sl[i] = sl[i + 1]
+	;;
+	-> sl[:sl.len - 1]
 }