equal
deleted
inserted
replaced
12 mem mem_int mem_string union union_int union_string inter inter_int |
12 mem mem_int mem_string union union_int union_string inter inter_int |
13 inter_string subset subset_int subset_string; |
13 inter_string subset subset_int subset_string; |
14 |
14 |
15 infix 3 oo ooo oooo; |
15 infix 3 oo ooo oooo; |
16 |
16 |
17 signature LIBRARY = |
17 signature BASIC_LIBRARY = |
18 sig |
18 sig |
19 (*functions*) |
19 (*functions*) |
20 val curry: ('a * 'b -> 'c) -> 'a -> 'b -> 'c |
20 val curry: ('a * 'b -> 'c) -> 'a -> 'b -> 'c |
21 val uncurry: ('a -> 'b -> 'c) -> 'a * 'b -> 'c |
21 val uncurry: ('a -> 'b -> 'c) -> 'a * 'b -> 'c |
22 val I: 'a -> 'a |
22 val I: 'a -> 'a |
190 val gen_subset: ('a * 'b -> bool) -> 'a list * 'b list -> bool |
190 val gen_subset: ('a * 'b -> bool) -> 'a list * 'b list -> bool |
191 val \ : ''a list * ''a -> ''a list |
191 val \ : ''a list * ''a -> ''a list |
192 val \\ : ''a list * ''a list -> ''a list |
192 val \\ : ''a list * ''a list -> ''a list |
193 val gen_rem: ('a * 'b -> bool) -> 'a list * 'b -> 'a list |
193 val gen_rem: ('a * 'b -> bool) -> 'a list * 'b -> 'a list |
194 val gen_rems: ('a * 'b -> bool) -> 'a list * 'b list -> 'a list |
194 val gen_rems: ('a * 'b -> bool) -> 'a list * 'b list -> 'a list |
|
195 val gen_remove: ('a * 'b -> bool) -> 'b -> 'a list -> 'a list |
|
196 val remove: ''a -> ''a list -> ''a list |
195 val gen_distinct: ('a * 'a -> bool) -> 'a list -> 'a list |
197 val gen_distinct: ('a * 'a -> bool) -> 'a list -> 'a list |
196 val distinct: ''a list -> ''a list |
198 val distinct: ''a list -> ''a list |
197 val findrep: ''a list -> ''a list |
199 val findrep: ''a list -> ''a list |
198 val gen_duplicates: ('a * 'a -> bool) -> 'a list -> 'a list |
200 val gen_duplicates: ('a * 'a -> bool) -> 'a list -> 'a list |
199 val duplicates: ''a list -> ''a list |
201 val duplicates: ''a list -> ''a list |
254 val partition_list: (int -> 'a -> bool) -> int -> int -> 'a list -> 'a list list |
256 val partition_list: (int -> 'a -> bool) -> int -> int -> 'a list -> 'a list list |
255 val gensym: string -> string |
257 val gensym: string -> string |
256 val scanwords: (string -> bool) -> string list -> string list |
258 val scanwords: (string -> bool) -> string list -> string list |
257 end; |
259 end; |
258 |
260 |
259 signature LIBRARY_CLOSED = |
261 signature LIBRARY = |
260 sig |
262 sig |
261 include LIBRARY |
263 include BASIC_LIBRARY |
262 |
264 |
263 val the: 'a option -> 'a |
265 val the: 'a option -> 'a |
264 val if_none: 'a option -> 'a -> 'a |
266 val if_none: 'a option -> 'a -> 'a |
265 val is_some: 'a option -> bool |
267 val is_some: 'a option -> bool |
266 val apsome: ('a -> 'b) -> 'a option -> 'b option |
268 val apsome: ('a -> 'b) -> 'a option -> 'b option |
277 val partition: ('a -> bool) -> 'a list -> 'a list * 'a list |
279 val partition: ('a -> bool) -> 'a list -> 'a list * 'a list |
278 val filter: ('a -> bool) -> 'a list -> 'a list |
280 val filter: ('a -> bool) -> 'a list -> 'a list |
279 val mapfilter: ('a -> 'b option) -> 'a list -> 'b list |
281 val mapfilter: ('a -> 'b option) -> 'a list -> 'b list |
280 end; |
282 end; |
281 |
283 |
282 structure Library: LIBRARY_CLOSED = |
284 structure Library: LIBRARY = |
283 struct |
285 struct |
284 |
286 |
285 |
287 |
286 (** functions **) |
288 (** functions **) |
287 |
289 |
931 |
933 |
932 (*removing an element from a list -- possibly WITH duplicates*) |
934 (*removing an element from a list -- possibly WITH duplicates*) |
933 fun gen_rem eq (xs, y) = filter_out (fn x => eq (x, y)) xs; |
935 fun gen_rem eq (xs, y) = filter_out (fn x => eq (x, y)) xs; |
934 fun gen_rems eq (xs, ys) = filter_out (fn x => gen_mem eq (x, ys)) xs; |
936 fun gen_rems eq (xs, ys) = filter_out (fn x => gen_mem eq (x, ys)) xs; |
935 |
937 |
|
938 fun gen_remove eq x xs = gen_rem eq (xs, x); |
|
939 fun remove x xs = gen_rem (op =) (xs, x); |
936 |
940 |
937 (*makes a list of the distinct members of the input; preserves order, takes |
941 (*makes a list of the distinct members of the input; preserves order, takes |
938 first of equal elements*) |
942 first of equal elements*) |
939 fun gen_distinct eq lst = |
943 fun gen_distinct eq lst = |
940 let |
944 let |
1287 in scan1 (#2 (take_prefix (not o is_let) cs)) end; |
1291 in scan1 (#2 (take_prefix (not o is_let) cs)) end; |
1288 |
1292 |
1289 |
1293 |
1290 end; |
1294 end; |
1291 |
1295 |
1292 structure OpenLibrary: LIBRARY = Library; |
1296 structure BasicLibrary: BASIC_LIBRARY = Library; |
1293 open OpenLibrary; |
1297 open BasicLibrary; |