compress the definition of freeze:attribute_goals//1

This commit is contained in:
Mark Thom
2019-11-30 14:12:33 -07:00
parent 0eb20a5d8e
commit a4cacaeab2
2 changed files with 4 additions and 14 deletions

View File

@@ -21,16 +21,6 @@ freeze(X, Goal) :-
put_atts(Fresh, frozen(Goal)),
Fresh = X.
gather_freeze_goals(Attrs, _) -->
{ var(Attrs) },
!.
gather_freeze_goals([frozen(X) | _], Var) -->
[freeze(Var, X)],
{ put_atts(Var, -frozen(_)) },
!.
gather_freeze_goals([_ | Attrs], Var) -->
gather_freeze_goals(Attrs, Var).
attribute_goals(X) -->
{ '$get_attr_list'(X, Attrs) },
gather_freeze_goals(Attrs, X).
attribute_goals(Var) -->
{ get_atts(Var, frozen(Goals)) },
[freeze(Var, Goals)].