adamc@646: datatype rlist = Nil | Cons of {Data : source string,
adamc@646: NewData : source string,
adamc@646: Tail : source rlist}
adamc@646:
adamc@646: fun showString ss =
adamc@646: s <- signal ss;
adamc@646: return {[s]}
adamc@646:
adamc@646: fun show rls =
adamc@646: v <- signal rls;
adamc@646: show' v
adamc@646:
adamc@646: and show' rl =
adamc@646: case rl of
adamc@646: Nil => return
adamc@646: | Cons {Data = ss, NewData = ss', Tail = rls} => return
adamc@646:
adamc@646:
adamc@646:
adamc@646:
adamc@646:
adamc@646:
adamc@646: fun main () =
adamc@646: head <- source Nil;
adamc@646: tailP <- source head;
adamc@646: data <- source "";
adamc@646:
adamc@646: let
adamc@646: fun add () =
adamc@646: data <- get data;
adamc@646: data <- source data;
adamc@646: ndata <- source "";
adamc@646: tail <- get tailP;
adamc@646: tail' <- source Nil;
adamc@646:
adamc@646: let
adamc@646: val cons = Cons {Data = data, NewData = ndata, Tail = tail'}
adamc@646: in
adamc@646: set tail cons;
adamc@646: set tailP tail';
adamc@646:
adamc@646: head' <- get head;
adamc@646: case head' of
adamc@646: Nil => set head cons
adamc@646: | _ => return ()
adamc@646: end
adamc@646: in
adamc@646: return
adamc@646:
adamc@646:
adamc@646:
adamc@646:
adamc@646:
adamc@646: end