comparison src/core_util.sml @ 493:ae03d09043c1

Add CutMulti
author Adam Chlipala <adamc@hcoop.net>
date Tue, 11 Nov 2008 19:20:37 -0500
parents 5521bb0b4014
children 3162bbf8e30f
comparison
equal deleted inserted replaced
492:4a241d108a2c 493:ae03d09043c1
442 | (EConcat _, _) => LESS 442 | (EConcat _, _) => LESS
443 | (_, EConcat _) => GREATER 443 | (_, EConcat _) => GREATER
444 444
445 | (ECut (e1, c1, _), ECut (e2, c2, _)) => 445 | (ECut (e1, c1, _), ECut (e2, c2, _)) =>
446 join (compare (e1, e2), 446 join (compare (e1, e2),
447 fn () => Con.compare (c1, c2)) 447 fn () => Con.compare (c1, c2))
448 | (ECut _, _) => LESS 448 | (ECut _, _) => LESS
449 | (_, ECut _) => GREATER 449 | (_, ECut _) => GREATER
450
451 | (ECutMulti (e1, c1, _), ECutMulti (e2, c2, _)) =>
452 join (compare (e1, e2),
453 fn () => Con.compare (c1, c2))
454 | (ECutMulti _, _) => LESS
455 | (_, ECutMulti _) => GREATER
450 456
451 | (EFold _, EFold _) => EQUAL 457 | (EFold _, EFold _) => EQUAL
452 | (EFold _, _) => LESS 458 | (EFold _, _) => LESS
453 | (_, EFold _) => GREATER 459 | (_, EFold _) => GREATER
454 460
586 S.bind2 (mfc ctx field, 592 S.bind2 (mfc ctx field,
587 fn field' => 593 fn field' =>
588 S.map2 (mfc ctx rest, 594 S.map2 (mfc ctx rest,
589 fn rest' => 595 fn rest' =>
590 (ECut (e', c', {field = field', rest = rest'}), loc))))) 596 (ECut (e', c', {field = field', rest = rest'}), loc)))))
597 | ECutMulti (e, c, {rest}) =>
598 S.bind2 (mfe ctx e,
599 fn e' =>
600 S.bind2 (mfc ctx c,
601 fn c' =>
602 S.map2 (mfc ctx rest,
603 fn rest' =>
604 (ECutMulti (e', c', {rest = rest'}), loc))))
591 | EFold k => 605 | EFold k =>
592 S.map2 (mfk k, 606 S.map2 (mfk k,
593 fn k' => 607 fn k' =>
594 (EFold k', loc)) 608 (EFold k', loc))
595 609