I will try to implement merge-sort on Arduino next time 
It is done:
Here is some output from a test run:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9 // sorted
6, 7, 0, 3, 4, 1, 5, 9, 8, 2 // randomized
0, 1, 2, 3, 4, 5, 6, 7, 8, 9 // sorted
6, 7, 1, 8, 5, 0, 3, 4, 2, 9 // randomized
… …On Tuesday, November 11, 2014 3:03:54 PM UTC-5, gmhwxi wrote:
Today I wrote a program that rotates a list (not array) of number.
For instance, say we start with 0, 1, 2, 3, 4; then we should see
0, 1, 2, 3, 4
1, 2, 3, 4, 0
2, 3, 4, 0, 1
3, 4, 0, 1, 2
4, 0, 1, 2, 3
0, 1, 2, 3, 4
… …
My code is here:
https://github.com/githwxi/ATS-Postiats-contrib/blob/master/contrib/arduino/TEST/ListOps/ListOps.dats
I find this to be a pretty cool example because it makes genuine use of
linear datatypes (plus pattern matching).
I will try to implement merge-sort on Arduino next time 
Cheers!
On Saturday, November 8, 2014 2:19:26 PM UTC-5, gmhwxi wrote:
FYI.
I managed to set up an API for Arduino programming:
https://github.com/githwxi/ATS-Postiats-contrib/tree/master/contrib/arduino
This is just the beginning, and more will be added once I get my Arduino
Uno.
Right now, I am using Arduino.mk to do compilation:
GitHub - sudar/Arduino-Makefile: Makefile for Arduino sketches. It defines the workflows for compiling code, flashing it to Arduino and even communicating through Serial.
There are some simple examples showing how this can be done:
https://github.com/githwxi/ATS-Postiats-contrib/tree/master/contrib/arduino
As Arduino uses C++, I rely on dot-notation overloading in ATS to mimic
method calls.
So far the syntax should be quite pleasant to use.
Cheers!