232 fun gen_set' aG i j = frequency |
232 fun gen_set' aG i j = frequency |
233 [(i, fn () => aG j :: gen_set' aG (i-1) j), (1, fn () => [])] () |
233 [(i, fn () => aG j :: gen_set' aG (i-1) j), (1, fn () => [])] () |
234 and gen_set aG i = gen_set' aG i i; |
234 and gen_set aG i = gen_set' aG i i; |
235 *} |
235 *} |
236 |
236 |
237 code_typapp set |
237 code_type set |
238 ml ("_ list") |
238 (SML "_ list") |
239 haskell (target_atom "[_]") |
239 (Haskell target_atom "[_]") |
240 |
240 |
241 |
241 |
242 subsection {* const serializations *} |
242 subsection {* const serializations *} |
243 |
243 |
244 consts_code |
244 consts_code |
259 code_constname |
259 code_constname |
260 "ExecutableSet.member" "List.member" |
260 "ExecutableSet.member" "List.member" |
261 "ExecutableSet.insertl" "List.insertl" |
261 "ExecutableSet.insertl" "List.insertl" |
262 "ExecutableSet.drop_first" "List.drop_first" |
262 "ExecutableSet.drop_first" "List.drop_first" |
263 |
263 |
264 code_generate (ml, haskell) |
264 code_gen |
265 insertl unionl intersect flip subtract map_distinct |
265 insertl unionl intersect flip subtract map_distinct |
266 unions intersects map_union map_inter Blall Blex |
266 unions intersects map_union map_inter Blall Blex |
267 |
267 (SML) (Haskell) |
268 code_constapp |
268 |
269 "{}" |
269 code_const "{}" |
270 ml (target_atom "[]") |
270 (SML target_atom "[]") |
271 haskell (target_atom "[]") |
271 (Haskell target_atom "[]") |
272 insert |
272 |
273 ml ("{*insertl*}") |
273 code_const insert |
274 haskell ("{*insertl*}") |
274 (SML "{*insertl*}") |
275 "op \<union>" |
275 (Haskell "{*insertl*}") |
276 ml ("{*unionl*}") |
276 |
277 haskell ("{*unionl*}") |
277 code_const "op \<union>" |
278 "op \<inter>" |
278 (SML "{*unionl*}") |
279 ml ("{*intersect*}") |
279 (Haskell "{*unionl*}") |
280 haskell ("{*intersect*}") |
280 |
281 "op - :: 'a set \<Rightarrow> 'a set \<Rightarrow> 'a set" |
281 code_const "op \<inter>" |
282 ml ("{*flip subtract*}") |
282 (SML "{*intersect*}") |
283 haskell ("{*flip subtract*}") |
283 (Haskell "{*intersect*}") |
284 image |
284 |
285 ml ("{*map_distinct*}") |
285 code_const "op - :: 'a set \<Rightarrow> 'a set \<Rightarrow> 'a set" |
286 haskell ("{*map_distinct*}") |
286 (SML "{*flip subtract*}") |
287 "Union" |
287 (Haskell "{*flip subtract*}") |
288 ml ("{*unions*}") |
288 |
289 haskell ("{*unions*}") |
289 code_const image |
290 "Inter" |
290 (SML "{*map_distinct*}") |
291 ml ("{*intersects*}") |
291 (Haskell "{*map_distinct*}") |
292 haskell ("{*intersects*}") |
292 |
293 UNION |
293 code_const "Union" |
294 ml ("{*map_union*}") |
294 (SML "{*unions*}") |
295 haskell ("{*map_union*}") |
295 (Haskell "{*unions*}") |
296 INTER |
296 |
297 ml ("{*map_inter*}") |
297 code_const "Inter" |
298 haskell ("{*map_inter*}") |
298 (SML "{*intersects*}") |
299 Ball |
299 (Haskell "{*intersects*}") |
300 ml ("{*Blall*}") |
300 |
301 haskell ("{*Blall*}") |
301 code_const UNION |
302 Bex |
302 (SML "{*map_union*}") |
303 ml ("{*Blex*}") |
303 (Haskell "{*map_union*}") |
304 haskell ("{*Blex*}") |
304 |
|
305 code_const INTER |
|
306 (SML "{*map_inter*}") |
|
307 (Haskell "{*map_inter*}") |
|
308 |
|
309 code_const Ball |
|
310 (SML "{*Blall*}") |
|
311 (Haskell "{*Blall*}") |
|
312 |
|
313 code_const Bex |
|
314 (SML "{*Blex*}") |
|
315 (Haskell "{*Blex*}") |
305 |
316 |
306 end |
317 end |