topsort : ('a -> 'a -> bool) -> 'a list -> 'a list
- fun is_subterm x y = Lib.can (find_term (aconv x)) y; > val is_subterm = fn : term -> term -> bool - topsort is_subterm [``x+1``, ``x:num``, ``y + (x + 1)``, ``y + x``, ``y + x + z``, ``y:num``]; > val it = [``y``, ``x``, ``x + 1``, ``y + x``, ``y + x + z``, ``y + (x + 1)``] : term list