From f4c6b5744925c409f5e9edca802ad29db4213d3e Mon Sep 17 00:00:00 2001 From: Sebeck10 Date: Mon, 14 Nov 2022 10:33:14 +0900 Subject: [PATCH] Fix file disposition --- tests-parsimony/boot.mc => boot.mc | 4 +++ tests-parsimony/map.c | 43 +++--------------------------- tests-parsimony/projExample.c | 2 +- 3 files changed, 8 insertions(+), 41 deletions(-) rename tests-parsimony/boot.mc => boot.mc (93%) diff --git a/tests-parsimony/boot.mc b/boot.mc similarity index 93% rename from tests-parsimony/boot.mc rename to boot.mc index 8131c91..dc3950c 100644 --- a/tests-parsimony/boot.mc +++ b/boot.mc @@ -1,4 +1,8 @@ @{ + createList() { + return {}; + } + append(s, e) { s[length(s)] = e; } diff --git a/tests-parsimony/map.c b/tests-parsimony/map.c index ea8f8ce..b3bbedf 100644 --- a/tests-parsimony/map.c +++ b/tests-parsimony/map.c @@ -1,42 +1,6 @@ -@{ - append(s, e) { - s[length(s)] = e; - } - - map(f, seq, g) { - out = {}; - if (g) { - for (i in seq) { - e = seq[i]; - if (g(e)) { e = f(e); } - append(out, e); - } - } else { - for (i in seq) { - append(out, f(seq[i])); - } - } - out; - } +@{import("boot.mc");} - select(f, s) { - out = {}; - for (i in s) { - e = s[i]; - if (f(e)) { append(out, e); } - } - out; - } - - reject(f, s) { - out = {}; - for (i in s) { - e = s[i]; - if (!f(e)) { append(out, e); } - } - out; - } - +@{ toChar(foo) { "\"type :"+foo+"\""; } @@ -45,8 +9,7 @@ } c = ["earth", "sky", "water"]; isSky(x) { x == "sky" } - c = reject(isSky, c); - + c = reject(isSky, c); } @{print(map(p2, [100, 2, 3]));} diff --git a/tests-parsimony/projExample.c b/tests-parsimony/projExample.c index 780f59c..38850fa 100644 --- a/tests-parsimony/projExample.c +++ b/tests-parsimony/projExample.c @@ -1,4 +1,4 @@ -@{import("tests-parsimony/boot.mc");} +@{import("boot.mc");} enum foo { Closed = 0, ReadOnly = 1, WriteOnly = 2 };