From 2f02189ddcdeb7d25b0ca9bd5b955b764d41a1a7 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sat, 21 May 2016 17:44:53 -0700 Subject: 2996 --- html/074list.mu.html | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'html/074list.mu.html') diff --git a/html/074list.mu.html b/html/074list.mu.html index bb619f3e..be4c153f 100644 --- a/html/074list.mu.html +++ b/html/074list.mu.html @@ -42,12 +42,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color next:address:list:_elem ] -def push x:_elem, in:address:list:_elem -> in:address:list:_elem [ +def push x:_elem, in:address:list:_elem -> result:address:list:_elem [ local-scope load-ingredients - result:address:list:_elem <- new {(list _elem): type} + result <- new {(list _elem): type} *result <- merge x, in - return result # needed explicitly because we need to replace 'in' with 'result' ] def first in:address:list:_elem -> result:_elem [ @@ -82,6 +81,15 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] ] +def length l:address:list:_elem -> result:number [ + local-scope + load-ingredients + return-unless l, 0 + rest:address:list:_elem <- rest l + length-of-rest:number <- length rest + result <- add length-of-rest, 1 +] + def to-text in:address:list:_elem -> result:address:array:character [ local-scope load-ingredients -- cgit 1.4.1-2-gfad0