Browse Source

Fix file disposition

develop-theo
Sebeck10 2 years ago
parent
commit
f4c6b57449
3 changed files with 8 additions and 41 deletions
  1. +4
    -0
      boot.mc
  2. +3
    -40
      tests-parsimony/map.c
  3. +1
    -1
      tests-parsimony/projExample.c

tests-parsimony/boot.mc → boot.mc View File

@ -1,4 +1,8 @@
@{
createList() {
return {};
}
append(s, e) {
s[length(s)] = e;
}

+ 3
- 40
tests-parsimony/map.c View File

@ -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]));}

+ 1
- 1
tests-parsimony/projExample.c View File

@ -1,4 +1,4 @@
@{import("tests-parsimony/boot.mc");}
@{import("boot.mc");}
enum foo { Closed = 0, ReadOnly = 1, WriteOnly = 2 };

Loading…
Cancel
Save