summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2016-04-29 23:27:56 -0700
committerOri Bernstein <ori@eigenstate.org>2016-04-29 23:27:56 -0700
commit56251d257472a214910a0d0861cae5090bdd83d9 (patch)
treece66461f1f2524538db249c2d6775c15d4726029
parentd4c21dfa1254208ac352246b3e36be1bde15a662 (diff)
downloadmc-56251d257472a214910a0d0861cae5090bdd83d9.tar.gz
Add slput
-rw-r--r--lib/std/slput.myr20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/std/slput.myr b/lib/std/slput.myr
index 7addd71..67f5498 100644
--- a/lib/std/slput.myr
+++ b/lib/std/slput.myr
@@ -3,26 +3,26 @@ use "alloc"
use "die"
pkg std =
- generic slput : (sl : @a[:], idx : size, elt : @a -> @a[:])
- generic sldel : (sl : @a[:], idx : size -> @a[:])
+ generic slput : (sl : @a[:]#, idx : size, elt : @a -> @a[:])
+ generic sldel : (sl : @a[:]#, idx : size -> @a[:])
;;
generic slput = {sl, idx, elt
var i
var len
- len = sl.len
- slgrow(&sl, sl.len + 1)
+ len = sl#.len
+ slgrow(sl, sl#.len + 1)
for i = len - 1; i >= idx; i--
- sl[i + 1] = sl[i]
+ sl#[i + 1] = sl#[i]
;;
- sl[idx] = elt
- -> sl
+ sl#[idx] = elt
+ -> sl#
}
generic sldel = {sl, idx
- for var i = idx; i < sl.len - 1; i++
- sl[i] = sl[i + 1]
+ for var i = idx; i < sl#.len - 1; i++
+ sl#[i] = sl#[i + 1]
;;
- -> sl[:sl.len - 1]
+ -> sl#[:sl#.len - 1]
}