comparison src/tag.sml @ 280:fdd7a698be01

Compiling a parametrized query the inefficient way
author Adam Chlipala <adamc@hcoop.net>
date Tue, 02 Sep 2008 17:31:45 -0400
parents 3bbed533fbd2
children 9117a7bf229c
comparison
equal deleted inserted replaced
279:8bb46d87b074 280:fdd7a698be01
214 let 214 let
215 val (app, _) = foldl (fn (t, (app, n)) => 215 val (app, _) = foldl (fn (t, (app, n)) =>
216 ((EApp (app, (ERel n, loc)), loc), 216 ((EApp (app, (ERel n, loc)), loc),
217 n - 1)) 217 n - 1))
218 ((ENamed f, loc), length args - 1) args 218 ((ENamed f, loc), length args - 1) args
219 val app = (EApp (app, (ERecord [], loc)), loc)
219 val body = (EWrite app, loc) 220 val body = (EWrite app, loc)
221 val t = (TFun (unit, unit), loc)
220 val (abs, _, t) = foldr (fn (t, (abs, n, rest)) => 222 val (abs, _, t) = foldr (fn (t, (abs, n, rest)) =>
221 ((EAbs ("x" ^ Int.toString n, 223 ((EAbs ("x" ^ Int.toString n,
222 t, 224 t,
223 rest, 225 rest,
224 abs), loc), 226 abs), loc),
225 n + 1, 227 n + 1,
226 (TFun (t, rest), loc))) 228 (TFun (t, rest), loc)))
227 (body, 0, unit) args 229 (body, 0, t) args
228 in 230 in
229 (abs, t) 231 (abs, t)
230 end 232 end
231 in 233 in
232 (("wrap_" ^ fnam, cn, t, abs, tag), 234 (("wrap_" ^ fnam, cn, t, abs, tag),