Created
August 2, 2023 20:51
-
-
Save yonta/136968f8316d26f8f050e22eee385dc6 to your computer and use it in GitHub Desktop.
Loop Cell
This file contains hidden or 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
datatype 'a cell = CELL of 'a * 'a cell option ref | |
val cell = CELL (1, ref NONE) | |
(* val cell = CELL (1, ref NONE) : int cell *) | |
val cellRef = ref (SOME cell) | |
(* val cellRef = ref (SOME (CELL (1, ref NONE))) : int cell option ref *) | |
cellRef := SOME (CELL (1, cellRef)) | |
(* val it = () : unit *) | |
cellRef | |
(* | |
val it = | |
ref | |
(SOME | |
(CELL | |
( | |
1, | |
ref | |
(SOME | |
(CELL | |
( | |
1, | |
ref | |
(SOME | |
(CELL | |
( | |
1, ref (SOME (CELL (1, ref (SOME (CELL (..., ...)))))) | |
))) | |
))) | |
))) | |
: int cell option ref | |
*) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment