diff options
author | Ori Bernstein <ori@eigenstate.org> | 2014-07-20 19:25:24 -0400 |
---|---|---|
committer | Ori Bernstein <ori@eigenstate.org> | 2014-07-20 19:25:24 -0400 |
commit | ec0241536de591d2f0f75a84ed3ee71cad8c5aae (patch) | |
tree | 689f5cf3ffa4c0cc5a6c0fd481e0bbd4c5c64b6f | |
parent | 5e8a15598f1399a8b0a296dac2af139e1ba28e16 (diff) | |
download | mc-ec0241536de591d2f0f75a84ed3ee71cad8c5aae.tar.gz |
Add 'swap' to libstd
-rw-r--r-- | libstd/Makefile | 1 | ||||
-rw-r--r-- | libstd/swap.myr | 11 |
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 +} |