Commit 35255836 authored by POTTIER Francois's avatar POTTIER Francois
Browse files

Misc.

parent 51b131f2
...@@ -8,9 +8,18 @@ let freeze = function ...@@ -8,9 +8,18 @@ let freeze = function
| ModePattern envref -> | ModePattern envref ->
ModeExpression !envref ModeExpression !envref
let embed = function
| ModeExpression env ->
env
| ModePattern envref ->
!envref (* TEMPORARY should keep OUTER env, not read current inner env *)
type 't freeze = type 't freeze =
't 't
type 't embed =
't
type ('p, 't) bind = type ('p, 't) bind =
'p * 't 'p * 't
...@@ -33,7 +42,13 @@ class virtual ['self] libmap = object (self : 'self) ...@@ -33,7 +42,13 @@ class virtual ['self] libmap = object (self : 'self)
('env mode -> 't1 -> 't2) -> ('env mode -> 't1 -> 't2) ->
'env mode -> 't1 -> 't2 'env mode -> 't1 -> 't2
= fun visit_t mode t1 -> = fun visit_t mode t1 ->
visit_t (freeze mode) t1 visit_t (freeze mode) t1
method private visit_embed: 'env 't1 't2 .
('env -> 't1 -> 't2) ->
'env mode -> 't1 -> 't2
= fun visit_t mode t1 ->
visit_t (embed mode) t1
method private visit_bind: 'env 'p1 'p2 't1 't2 . method private visit_bind: 'env 'p1 'p2 't1 't2 .
('env mode -> 'p1 -> 'p2) -> ('env mode -> 'p1 -> 'p2) ->
...@@ -219,3 +234,23 @@ class virtual ['self] map = object (self : 'self) ...@@ -219,3 +234,23 @@ class virtual ['self] map = object (self : 'self)
end end
*) *)
(*
Un morceau de visit_tele revu en forme de map:
method private visit_tele_essai: 't1 't2 .
('env -> 't1 -> 't2) ->
'env ref -> ('bn1, 't1) tele -> ('bn2, 't2) tele
= fun visit_t current xts1 ->
match xts1 with
| [] ->
[]
| (x1, t1) :: xts1 ->
let env = !current in
let t2 = visit_t env t1 in
let x2, env = self#extend x1 env in
current := env;
let xts2 = self#visit_tele_essai visit_t current xts1 in
(x2, t2) :: xts2
*)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment