From 8c7809d024e85d0a8acfb794a4db41b0e4bc13e6 Mon Sep 17 00:00:00 2001 From: Shinya Sato Date: Mon, 2 May 2022 09:49:01 +0900 Subject: v0.8.2-1 --- comparison/SML/dummy.sml | 55 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 comparison/SML/dummy.sml (limited to 'comparison/SML/dummy.sml') diff --git a/comparison/SML/dummy.sml b/comparison/SML/dummy.sml new file mode 100644 index 0000000..15ff263 --- /dev/null +++ b/comparison/SML/dummy.sml @@ -0,0 +1,55 @@ +(* https://stackoverflow.com/questions/25839939/understanding-merge-sort-in-ml *) + +fun split [] = ([], []) + | split [a] = ([a], []) + | split (a::b::cs) = + let + val (m,n) = split cs + in + (a::m, b::n) + end; + +fun merge ([], ys) = ys + | merge (xs, []) = xs + | merge (x::xs, y::ys) = + if x