1. Yujie Wu
  2. PrologFun

Commits

Yujie Wu  committed c662bc2

Added a `subset' rule for the set data structure.

  • Participants
  • Parent commits b60f785
  • Branches feature/set

Comments (0)

Files changed (1)

File set/set.pl

View file
 
 
 
+% Subset
+% True if the first set is a subset of the second one.
+subset( [],            _          ).
+subset( [Elem | Tail], [E    | T] ) :- Elem  > E, subset( [Elem | Tail], T ).
+subset( [Elem | Tail], [Elem | T] ) :-            subset(         Tail,  T ).
+
+
+
+
+