
expr::new := λ . (StrictExpr(() () () () () () () () 0));
expr::get-type := λe . (match e (
   ()
   ((Expr(f p u t d pc off)) ())
   ((StrictExpr(tt f u t d p e c o)) tt)
));
expr::get-frame := λe . (match e (
   ()
   ((Expr(f p u t d pc off)) f)
   ((StrictExpr(tt f u t d p e c o)) f)
));
expr::get-unframe := λe . (match e (
   ()
   ((Expr(f p u t d pc off)) u)
   ((StrictExpr(tt f u t d p e c o)) u)
));
expr::get-text := λe . (match e (
   ()
   ((Expr(f p u t d pc off)) t)
   ((StrictExpr(tt f u t d p e c o)) t)
));
expr::get-data := λe . (match e (
   ()
   ((Expr(f p u t d pc off)) d)
   ((StrictExpr(tt f u t d p e c o)) d)
));
expr::get-prog := λe . (match e (
   ()
   ((Expr(f p u t d pc off)) p)
   ((StrictExpr(tt f u t d p e c o)) p)
));
expr::get-expr := λe . (match e (
   ()
   ((StrictExpr(tt f u t d p x c o)) x)
));
expr::get-context := λe . (match e (
   ()
   ((Expr(f p u t d pc off)) pc)
   ((StrictExpr(tt f u t d p e c o)) c)
));
expr::get-offset := λe . (match e (
   ()
   ((Expr(f p u t d pc off)) off )
   ((StrictExpr(tt f u t d p e c o)) o )
));
expr::set-frame := λe x . (
   (StrictExpr(
      (expr::get-type e)
      x
      (expr::get-unframe e)
      (expr::get-text e)
      (expr::get-data e)
      (expr::get-prog e)
      (expr::get-expr e)
      (expr::get-context e)
      (expr::get-offset e)
   ))
);
expr::set-unframe := λe x . (
   (StrictExpr(
      (expr::get-type e)
      (expr::get-frame e)
      x
      (expr::get-text e)
      (expr::get-data e)
      (expr::get-prog e)
      (expr::get-expr e)
      (expr::get-context e)
      (expr::get-offset e)
   ))
);
expr::set-text := λe x . (
   (StrictExpr(
      (expr::get-type e)
      (expr::get-frame e)
      (expr::get-unframe e)
      x
      (expr::get-data e)
      (expr::get-prog e)
      (expr::get-expr e)
      (expr::get-context e)
      (expr::get-offset e)
   ))
);
expr::set-data := λe x . (
   (StrictExpr(
      (expr::get-type e)
      (expr::get-frame e)
      (expr::get-unframe e)
      (expr::get-text e)
      x
      (expr::get-prog e)
      (expr::get-expr e)
      (expr::get-context e)
      (expr::get-offset e)
   ))
);
expr::set-prog := λe x . (
   (StrictExpr(
      (expr::get-type e)
      (expr::get-frame e)
      (expr::get-unframe e)
      (expr::get-text e)
      (expr::get-data e)
      x
      (expr::get-expr e)
      (expr::get-context e)
      (expr::get-offset e)
   ))
);
expr::set-expr := λe x . (
   (StrictExpr(
      (expr::get-type e)
      (expr::get-frame e)
      (expr::get-unframe e)
      (expr::get-text e)
      (expr::get-data e)
      (expr::get-prog e)
      x
      (expr::get-context e)
      (expr::get-offset e)
   ))
);
expr::set-context := λe x . (
   (StrictExpr(
      (expr::get-type e)
      (expr::get-frame e)
      (expr::get-unframe e)
      (expr::get-text e)
      (expr::get-data e)
      (expr::get-prog e)
      (expr::get-expr e)
      x
      (expr::get-offset e)
   ))
);
expr::set-offset := λe x . (
   (StrictExpr(
      (expr::get-type e)
      (expr::get-frame e)
      (expr::get-unframe e)
      (expr::get-text e)
      (expr::get-data e)
      (expr::get-prog e)
      (expr::get-expr e)
      (expr::get-context e)
      x
   ))
);
expr::set-type := λe x . (
   (StrictExpr(
      x
      (expr::get-frame e)
      (expr::get-unframe e)
      (expr::get-text e)
      (expr::get-data e)
      (expr::get-prog e)
      (expr::get-expr e)
      (expr::get-context e)
      (expr::get-offset e)
   ))
);

expr::chain := λ e1 e2 . (tail(
   (set e1 (expr::set-type(
      e1 (expr::get-type e2)
   )))
   (set e1 (expr::set-expr(
      e1 (expr::get-expr e2)
   )))
   (set e1 (expr::set-prog(
      e1 ( (expr::get-prog e1) (expr::get-prog e2) )
   )))
   (set e1 (expr::set-data(
      e1 ( (expr::get-data e1) (expr::get-data e2) )
   )))
   (set e1 (expr::set-text(
      e1 ( (expr::get-text e1) (expr::get-text e2) )
   )))
   (set e1 (expr::set-frame(
      e1 ( (expr::get-frame e1) (expr::get-frame e2) )
   )))
   (set e1 (expr::set-unframe(
      e1 ( (expr::get-unframe e1) (expr::get-unframe e2) )
   )))
   (set e1 (expr::set-offset( e1 (expr::get-offset e2) )))
   (set e1 (expr::set-context( e1 (expr::get-context e2) )))
   e1
));

expr::print := λ e . (tail(
   (print-s Expr)(print-s \n)
   (print-s 'offset:)(print-s \n)
   (print-s \t)(print-s (expr::get-offset e))(print-s \n)
   (print-s 'expr:)(print-s \n)
   (print-s \t)(print-s (expr::get-expr e))(print-s \n)
   (print-s 'text:)(print-s \n)
   (print-s \t)(print-s (expr::get-text e))(print-s \n)
   (print-s 'data:)(print-s \n)
   (print-s \t)(print-s (expr::get-data e))(print-s \n)
   (print-s 'frame:)(print-s \n)
   (print-s \t)(print-s (expr::get-frame e))(print-s \n)
   (print-s 'unframe:)(print-s \n)
   (print-s \t)(print-s (expr::get-unframe e))(print-s \n)
));
