Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,18 @@
def makeType(label, superstamps) {
def stamp {
to audit(audition) {
for s in superstamps { audition.ask(s) }
return true
}
}
def guard {
to coerce(specimen, ejector) {
if (__auditedBy(stamp, specimen)) {
return specimen
} else {
throw.eject(ejector, `$specimen is not a $label`)
}
}
}
return [guard, stamp]
}

View file

@ -0,0 +1,7 @@
def [Animal, AnimalStamp] := makeType("Animal", [])
def [Cat, CatStamp] := makeType("Cat", [AnimalStamp])
def [Dog, DogStamp] := makeType("Dog", [AnimalStamp])
def [Lab, LabStamp] := makeType("Lab", [DogStamp])
def [Collie, CollieStamp] := makeType("Collie", [DogStamp])

View file

@ -0,0 +1,3 @@
def fido implements LabStamp {}
def tom implements CatStamp {}
def brick {} # not an animal

View file

@ -0,0 +1,17 @@
? fido :Animal
# value: <fido>
? fido :Cat
# problem: <fido> is not a Cat
? fido :Lab
# value: <fido>
? tom :Animal
# value: <tom>
? tom :Cat
# value: <tom>
? brick :Animal
# problem: <brick> is not a Animal