Mercurial > urweb
diff src/reduce.sml @ 493:ae03d09043c1
Add CutMulti
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Tue, 11 Nov 2008 19:20:37 -0500 |
parents | dfc8c991abd0 |
children | 04053089878a |
line wrap: on
line diff
--- a/src/reduce.sml Tue Nov 11 18:39:38 2008 -0500 +++ b/src/reduce.sml Tue Nov 11 19:20:37 2008 -0500 @@ -133,6 +133,19 @@ in #1 (reduceExp env (ERecord (fields (xts, [])), loc)) end + | ECutMulti (r as (_, loc), _, {rest = (CRecord (k, xts), _), ...}) => + let + fun fields (remaining, passed) = + case remaining of + [] => [] + | (x, t) :: rest => + (x, + (EField (r, x, {field = t, + rest = (CRecord (k, List.revAppend (passed, rest)), loc)}), loc), + t) :: fields (rest, (x, t) :: passed) + in + #1 (reduceExp env (ERecord (fields (xts, [])), loc)) + end | _ => e in