summaryrefslogtreecommitdiff
path: root/libstd/sldup.myr
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2013-10-19 00:47:14 -0400
committerOri Bernstein <ori@eigenstate.org>2013-10-19 00:47:14 -0400
commitdc52d457fd6efb778cb91a7912e5c1329d8c34ef (patch)
tree7a534c1a599f14298507f1be3d13b8a92770192d /libstd/sldup.myr
parentdd0cb53f937c9a47c76ac6f4c2913287b2e65d02 (diff)
downloadmc-dc52d457fd6efb778cb91a7912e5c1329d8c34ef.tar.gz
Add sldup() function to standard library.
Diffstat (limited to 'libstd/sldup.myr')
-rw-r--r--libstd/sldup.myr15
1 files changed, 15 insertions, 0 deletions
diff --git a/libstd/sldup.myr b/libstd/sldup.myr
new file mode 100644
index 0000000..70cbee4
--- /dev/null
+++ b/libstd/sldup.myr
@@ -0,0 +1,15 @@
+use "alloc.use"
+use "die.use"
+use "slcp.use"
+
+pkg std =
+ generic sldup : (sl : @a[:] -> @a[:])
+;;
+
+generic sldup = {sl
+ var ret
+
+ ret = slalloc(sl.len)
+ slcp(ret, sl)
+ -> ret
+}