Typed Variables

A common pattern is to add a type check for variables in a rule. We saw this in our bachelor rule in [negation]:

?Person[bachelor] :-
  ?Person : Man,
  \+ ?Person [spouse -> ?Spouse].

Flora has a convenient shorthand syntax for that is equivalent to this:

?Person^^Man[bachelor] :-
  \+ ?Person [spouse -> ?Spouse].

This doesn’t save any typing, but it documents more clearly the intended types of arguments to a rule.