comparison 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
comparison
equal deleted inserted replaced
492:4a241d108a2c 493:ae03d09043c1
131 rest = (CRecord (k, List.revAppend (passed, rest)), loc)}), loc), 131 rest = (CRecord (k, List.revAppend (passed, rest)), loc)}), loc),
132 t) :: fields (rest, (x, t) :: passed) 132 t) :: fields (rest, (x, t) :: passed)
133 in 133 in
134 #1 (reduceExp env (ERecord (fields (xts, [])), loc)) 134 #1 (reduceExp env (ERecord (fields (xts, [])), loc))
135 end 135 end
136 | ECutMulti (r as (_, loc), _, {rest = (CRecord (k, xts), _), ...}) =>
137 let
138 fun fields (remaining, passed) =
139 case remaining of
140 [] => []
141 | (x, t) :: rest =>
142 (x,
143 (EField (r, x, {field = t,
144 rest = (CRecord (k, List.revAppend (passed, rest)), loc)}), loc),
145 t) :: fields (rest, (x, t) :: passed)
146 in
147 #1 (reduceExp env (ERecord (fields (xts, [])), loc))
148 end
136 149
137 | _ => e 150 | _ => e
138 in 151 in
139 (*Print.prefaces "exp'" [("e", CorePrint.p_exp env (e, ErrorMsg.dummySpan)), 152 (*Print.prefaces "exp'" [("e", CorePrint.p_exp env (e, ErrorMsg.dummySpan)),
140 ("r", CorePrint.p_exp env (r, ErrorMsg.dummySpan))];*) 153 ("r", CorePrint.p_exp env (r, ErrorMsg.dummySpan))];*)