5.6 Single Sided Unification rules
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • SWI-Prolog extensions
        • Single Sided Unification rules
          • Single Sided Unification Guards
          • Consequenses of => single sided unification rules
            • rule/2
            • rule/3
          • SSU: Future considerations
    • Packages

5.6.2 Consequenses of => single sided unification rules

The =>/2 construct is handled by the low-level compiler if no guard is present. If a guard is present it is currently compiled into the construct below. The Picat ?=>/2 neck operator is like =>/2, but does not commit to this rule. We are not yet sure whether or not SWI-Prolog will remain supporting ?=>/2.180?=>/2 is currently implemented but not defined as an operator.

Head ?=> Guard, !, Body.

The main consequence is that clause/2 cannot distinguish between a normal clause and a =>/2 clause. In the current implementation it operates on both without distinguishing the two. This implies e.g., cross referencing still works. Meta interpretation however does not work. In future versions clause/2 may fail on these rules. As an alternative we provide rule/2,3.

rule(:Head, -Rule)
rule(:Head, -Rule, -Ref)
True when Rule is a rule/clause that implements Head. Rule is a complete rule term. For a normal clause this is a term Head :- Body and for a single sided unification rule it is a term Head => Body.