757 the_default: 'a -> 'a option -> 'a |
757 the_default: 'a -> 'a option -> 'a |
758 the_list: 'a option -> 'a list |
758 the_list: 'a option -> 'a list |
759 |
759 |
760 * Pure/General: structure AList (cf. Pure/General/alist.ML) provides |
760 * Pure/General: structure AList (cf. Pure/General/alist.ML) provides |
761 basic operations for association lists, following natural argument |
761 basic operations for association lists, following natural argument |
762 order; ; moreover the explicit equality predicate passed here avoids |
762 order; moreover the explicit equality predicate passed here avoids |
763 potentially expensive polymorphic runtime equality checks. |
763 potentially expensive polymorphic runtime equality checks. |
764 The old functions may be expressed as follows: |
764 The old functions may be expressed as follows: |
765 |
765 |
766 assoc = uncurry (AList.lookup (op =)) |
766 assoc = uncurry (AList.lookup (op =)) |
767 assocs = these oo AList.lookup (op =) |
767 assocs = these oo AList.lookup (op =) |
768 overwrite = uncurry (AList.update (op =)) o swap |
768 overwrite = uncurry (AList.update (op =)) o swap |
|
769 |
|
770 * Pure/General: structure AList (cf. Pure/General/alist.ML) provides |
|
771 |
|
772 val make: ('a -> 'b) -> 'a list -> ('a * 'b) list |
|
773 val find: ('a * 'b -> bool) -> ('c * 'b) list -> 'a -> 'c list |
|
774 |
|
775 replacing make_keylist and keyfilter (occassionally used) |
|
776 Naive rewrites: |
|
777 |
|
778 make_keylist = AList.make |
|
779 keyfilter = AList.find (op =) |
|
780 |
|
781 * eq_fst and eq_snd now take explicit equality parameter, thus |
|
782 avoiding eqtypes. Naive rewrites: |
|
783 |
|
784 eq_fst = eq_fst (op =) |
|
785 eq_snd = eq_snd (op =) |
|
786 |
|
787 * Removed deprecated apl and apr (rarely used). |
|
788 Naive rewrites: |
|
789 |
|
790 apl (n, op) =>>= curry op n |
|
791 apr (op, m) =>>= fn n => op (n, m) |
769 |
792 |
770 * Pure/General: structure OrdList (cf. Pure/General/ord_list.ML) |
793 * Pure/General: structure OrdList (cf. Pure/General/ord_list.ML) |
771 provides a reasonably efficient light-weight implementation of sets as |
794 provides a reasonably efficient light-weight implementation of sets as |
772 lists. |
795 lists. |
773 |
796 |