comparison src/reduce.sml @ 339:075b36dbb1a4

Crud supports INSERT
author Adam Chlipala <adamc@hcoop.net>
date Sun, 14 Sep 2008 15:10:04 -0400
parents f307cdd08d81
children e0e9e9eca1cb
comparison
equal deleted inserted replaced
338:e976b187d73a 339:075b36dbb1a4
128 | EField ((ERecord xes, _), (CName x, _), _) => 128 | EField ((ERecord xes, _), (CName x, _), _) =>
129 (case List.find (fn ((CName x', _), _, _) => x' = x 129 (case List.find (fn ((CName x', _), _, _) => x' = x
130 | _ => false) xes of 130 | _ => false) xes of
131 SOME (_, e, _) => #1 e 131 SOME (_, e, _) => #1 e
132 | NONE => e) 132 | NONE => e)
133 | EWith (r as (_, loc), x, e, {rest = (CRecord (k, xts), _), field}) =>
134 let
135 fun fields (remaining, passed) =
136 case remaining of
137 [] => []
138 | (x, t) :: rest =>
139 (x,
140 (EField (r, x, {field = t,
141 rest = (CRecord (k, List.revAppend (passed, rest)), loc)}), loc),
142 t) :: fields (rest, (x, t) :: passed)
143 in
144 #1 (reduceExp env (ERecord ((x, e, field) :: fields (xts, [])), loc))
145 end
133 | ECut (r as (_, loc), _, {rest = (CRecord (k, xts), _), ...}) => 146 | ECut (r as (_, loc), _, {rest = (CRecord (k, xts), _), ...}) =>
134 let 147 let
135 fun fields (remaining, passed) = 148 fun fields (remaining, passed) =
136 case remaining of 149 case remaining of
137 [] => [] 150 [] => []