init commit again

This commit is contained in:
Peter
2023-11-01 09:29:33 +01:00
parent 448147e7da
commit d6c745207b
250 changed files with 15552 additions and 1 deletions

View File

@@ -0,0 +1,14 @@
general {
funcon-term:
initialise-giving
initialise-binding
give({"a"|->false,"b"|->true},
case-match-loosely(
{"b"|->pattern-bind"d"},
bound-value"d"))
;
}
tests {
result-term: true;
}

View File

@@ -0,0 +1,14 @@
general {
funcon-term:
initialise-giving
initialise-binding
give({"a"|->false,"b"|->true},
case-match(
{"b"|->pattern-bind"d","a"|->pattern-bind"c"},
bound-value"d"))
;
}
tests {
result-term: true;
}

View File

@@ -0,0 +1,18 @@
general {
funcon-term:
initialise-giving
initialise-binding
give(
variant("a",true),
sequential (
print case-variant-value("a"),
else(
effect case-variant-value"b",
print"OK")))
;
}
tests {
result-term: null-value;
standard-out: [true, "OK"];
}

View File

@@ -0,0 +1,36 @@
general {
funcon-term:
initialise-giving
initialise-binding
sequential(
check-true is-equal(
match-loosely([],[]), map()),
check-true is-equal(
match-loosely([false],[pattern-bind"b"]),
{"b"|->false}),
check-true is-equal(
match-loosely([false,true],[pattern-bind"a",pattern-bind"b"]),
{"a"|->false,"b"|->true}),
check-true is-equal(
match-loosely({"a"|->false},map()), map()),
check-true is-equal(
match-loosely({"a"|->false,"b"|->true},{"b"|->pattern-bind"d"}),
{"d"|->true}),
check-true is-equal(
match-loosely(true,true), map()),
else(
effect match-loosely([],[false]),
effect match-loosely([false],[false,false]),
effect match-loosely([false,true],[pattern-bind"a",pattern-bind"a"]),
effect match-loosely(map(),{"a"|->true}),
effect match-loosely({"a"|->true},{"a"|->false}),
effect match-loosely({"b"|->true},{"b"|->pattern-any,"c"|->pattern-any}),
effect match-loosely(false,true),
print"OK"))
;
}
tests {
result-term: null-value;
standard-out: ["OK"];
}

View File

@@ -0,0 +1,35 @@
general {
funcon-term:
initialise-giving
initialise-binding
sequential(
check-true is-equal(
match([],[]), map()),
check-true is-equal(
match([false],[pattern-bind"b"]),
{"b"|->false}),
check-true is-equal(
match([false,true],[pattern-bind"a",pattern-bind"b"]),
{"a"|->false,"b"|->true}),
check-true is-equal(
match(map(),map()), map()),
check-true is-equal(
match({"a"|->false,"b"|->true},{"b"|->pattern-bind"d","a"|->pattern-bind"c"}),
{"c"|->false,"d"|->true}),
check-true is-equal(
match(true,true), map()),
else(
effect match([],[false]),
effect match([false],[false,false]),
effect match([false,true],[pattern-bind"a",pattern-bind"a"]),
effect match(map(),{"a"|->true}),
effect match({"b"|->true},{"b"|->pattern-any,"c"|->pattern-any}),
effect match(false,true),
print"OK"))
;
}
tests {
result-term: null-value;
standard-out: ["OK"];
}

View File

@@ -0,0 +1,18 @@
general {
funcon-term:
initialise-giving
initialise-binding
sequential(
check-true is-equal(match(not true,pattern-any), map()),
check-true is-equal(match([42],pattern-any), map()),
check-true is-equal(match(abstraction null-value,pattern-any), map()),
check-true is-equal(match(list(42),pattern-any), map()),
check-true is-equal(match(tuple(42),pattern-any), map()),
print"OK")
;
}
tests {
result-term: null-value;
standard-out: ["OK"];
}

View File

@@ -0,0 +1,19 @@
general {
funcon-term:
initialise-giving
initialise-binding
sequential(
check-true is-equal(match(false,pattern-bind"it"), {"it"|->false}),
check-true is-equal(match([42],pattern-bind"it"), {"it"|->[42]}),
check-true is-equal(dom match(abstraction null-value,pattern-bind"it"), {"it"}),
check-true is-equal(match(abstraction 12,abstraction(pattern-bind "it")), {"it" |-> 12}),
check-true is-equal(match(vector(42),pattern-bind"it"), {"it"|->vector(42)}),
check-true is-equal(match(tuple(42),pattern-bind"it"), {"it"|->tuple(42)}),
print"OK")
;
}
tests {
result-term: null-value;
standard-out: ["OK"];
}

View File

@@ -0,0 +1,19 @@
general {
funcon-term:
initialise-giving
initialise-binding
sequential(
check-true is-equal(
match(false,pattern-else(pattern-bind"a",pattern-bind"b")), {"a"|->false}),
check-true is-equal(
match(false,pattern-else(pattern-type integers,pattern-bind"b")), {"b"|->false}),
else(
effect match(false,pattern-else(pattern-type integers,pattern-type atoms)),
print"OK"))
;
}
tests {
result-term: null-value;
standard-out: ["OK"];
}

View File

@@ -0,0 +1,24 @@
general {
funcon-term:
initialise-giving
initialise-binding
sequential(
check-true is-equal(match(false,pattern-type booleans), map()),
check-true is-equal(match([42],pattern-type lists(integers)), map()),
check-true is-equal(match(abstraction null-value,pattern-type abstractions(values=>values)), map()),
check-true is-equal(match(list(true),pattern-type lists(booleans)), map()),
check-true is-equal(match(tuple(42,true),pattern-type tuples(integers,booleans)), map()),
effect else(
match(true,pattern-type integers),
match([42],pattern-type lists(booleans)),
match(abstraction null-value,pattern-type atoms),
match(list(true),pattern-type lists(integers)),
match(tuple(42,true),pattern-type tuples(booleans,integers)),
print"OK"))
;
}
tests {
result-term: null-value;
standard-out: ["OK"];
}

View File

@@ -0,0 +1,19 @@
general {
funcon-term:
initialise-giving
initialise-binding
sequential(
check-true is-equal(
match(false,pattern-unite(pattern-bind"a",pattern-bind"b")), {"a"|->false,"b"|->false}),
check-true is-equal(
match(false,pattern-unite(pattern-type booleans,pattern-bind"b")), {"b"|->false}),
else(
effect match(false,pattern-unite(pattern-bind"a",pattern-bind"a")),
print"OK"))
;
}
tests {
result-term: null-value;
standard-out: ["OK"];
}