summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2014-07-20 19:25:24 -0400
committerOri Bernstein <ori@eigenstate.org>2014-07-20 19:25:24 -0400
commitec0241536de591d2f0f75a84ed3ee71cad8c5aae (patch)
tree689f5cf3ffa4c0cc5a6c0fd481e0bbd4c5c64b6f
parent5e8a15598f1399a8b0a296dac2af139e1ba28e16 (diff)
downloadmc-ec0241536de591d2f0f75a84ed3ee71cad8c5aae.tar.gz
Add 'swap' to libstd
-rw-r--r--libstd/Makefile1
-rw-r--r--libstd/swap.myr11
2 files changed, 12 insertions, 0 deletions
diff --git a/libstd/Makefile b/libstd/Makefile
index 731fd5e..e6b77df 100644
--- a/libstd/Makefile
+++ b/libstd/Makefile
@@ -43,6 +43,7 @@ MYRSRC= \
strjoin.myr \
strsplit.myr \
strstrip.myr \
+ swap.myr \
sys.myr \
try.myr \
types.myr \
diff --git a/libstd/swap.myr b/libstd/swap.myr
new file mode 100644
index 0000000..e3923c9
--- /dev/null
+++ b/libstd/swap.myr
@@ -0,0 +1,11 @@
+pkg std =
+ generic swap : (a : @a#, b : @a# -> void)
+;;
+
+generic swap = {a : @a#, b : @a#
+ var t
+
+ t = a#
+ a# = b#
+ b# = t
+}