Mercurial > urweb
diff src/reduce.sml @ 149:7420fa18d657
Record cut
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 24 Jul 2008 10:09:21 -0400 |
parents | 55d8cfa4d024 |
children | 8a70e2919e86 |
line wrap: on
line diff
--- a/src/reduce.sml Tue Jul 22 19:12:25 2008 -0400 +++ b/src/reduce.sml Thu Jul 24 10:09:21 2008 -0400 @@ -164,6 +164,19 @@ | _ => false) xes of SOME (_, e, _) => #1 e | NONE => e) + | ECut (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