diff --git a/src/test/list/reverse2-debug.imp b/src/test/list/reverse2-debug.imp new file mode 100644 index 00000000..99ca23f0 --- /dev/null +++ b/src/test/list/reverse2-debug.imp @@ -0,0 +1,32 @@ +_reverse(l, l_next) { + match l_next with + Nil -> { + // alias(*(l.Cons.2) = l_next); + return l + } + | Cons(h, t) -> { + let t_deref = *t in { + t := l; + alias(l_next.Cons.2 = t); + let reversed = _reverse(l_next, t_deref) in + reversed + } + } +} + +reverse(l) { + match l with + Nil -> l + | Cons(h, r) -> { + let reversed = _reverse(Nil, l) in + reversed + } +} + +{ + let n = mkref Nil in + let m = mkref Cons(1, n) in + let l = Cons(2, m) in + let rev_l = reverse(l) in + () +} \ No newline at end of file diff --git a/src/test/list/reverse2.imp b/src/test/list/reverse2.imp index 09d99c3b..d15e56db 100644 --- a/src/test/list/reverse2.imp +++ b/src/test/list/reverse2.imp @@ -10,7 +10,7 @@ mklist(n) { _reverse(l, l_next) { match l_next with Nil -> { - alias(*(l.Cons.2) = l_next); + // alias(*(l.Cons.2) = l_next); return l } | Cons(h, t) -> {