-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop/mochi-backend' of github.com:SoftwareFoundation…
…GroupAtKyotoU/consort into feature/call-mochi
- Loading branch information
Showing
3 changed files
with
36 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters