compound context seq fn: inherit
inherit:
description:
inherit[parent-type, op] input-seq
inherit the given operator from the given parent-type
We also try our best to maintain the "structure" of input-seq
examples:
-- learn the parent types for an old cat named trudy:
parent-type |trudy> => |cat>
parent-type |cat> => |feline>
parent-type |feline> => |mammal>
parent-type |mammal> => |animal>
-- learn some features from parent types:
has-fur |animal> => |yes>
has-teeth |animal> => |yes>
has-pointy-ears |feline> => |yes>
-- Trudy is an old cat, so has no teeth left:
has-teeth |trudy> => |no>
-- now, we can ask some questions:
-- does trudy have pointy ears? Which we expect to inherit from feline
inherit[parent-type, has-pointy-ears] |trudy>
|yes>
-- does trudy have fur? Which we expect to inherit from animal
inherit[parent-type, has-fur] |trudy>
|yes>
-- does trudy have teeth? Which we inherit from animal, but is over-ridden by trudy:
inherit[parent-type, has-teeth] |trudy>
|no>
-- now, learn some info about a dog called rex:
parent-type |rex> => |dog>
parent-type |dog> => |canine>
parent-type |canine> => |mammal>
-- we already know the parent type of mammal is an animal
-- do trudy and rex have teeth?
inherit[parent-type, has-teeth] (|trudy> + |rex>)
|no> + |yes>
see also:
inherit-path
Home