From 1e9aef828c057356badd464fcf7edb2f02d0b216 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Sat, 21 May 2011 22:11:42 -0400 Subject: [PATCH] stdlib: Reindent list.rs --- src/lib/list.rs | 60 ++++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/src/lib/list.rs b/src/lib/list.rs index 86d6c21dacca..7ffbf527f029 100644 --- a/src/lib/list.rs +++ b/src/lib/list.rs @@ -11,49 +11,49 @@ tag list[T] { } fn foldl[T,U](&list[T] ls, &U u, fn(&T t, &U u) -> U f) -> U { - alt(ls) { - case (cons[T](?hd, ?tl)) { - auto u_ = f(hd, u); - // FIXME: should use 'be' here, not 'ret'. But parametric - // tail calls currently don't work. - ret foldl[T,U](*tl, u_, f); + alt(ls) { + case (cons[T](?hd, ?tl)) { + auto u_ = f(hd, u); + // FIXME: should use 'be' here, not 'ret'. But parametric + // tail calls currently don't work. + ret foldl[T,U](*tl, u_, f); + } + case (nil[T]) { + ret u; + } } - case (nil[T]) { - ret u; - } - } - fail; // TODO: remove me when exhaustiveness checking works + fail; // TODO: remove me when exhaustiveness checking works } fn find[T,U](&list[T] ls, (fn(&T) -> option::t[U]) f) -> option::t[U] { - alt(ls) { - case (cons[T](?hd, ?tl)) { - alt (f(hd)) { - case (none[U]) { - // FIXME: should use 'be' here, not 'ret'. But parametric tail - // calls currently don't work. - ret find[T,U](*tl, f); - } - case (some[U](?res)) { - ret some[U](res); + alt(ls) { + case (cons[T](?hd, ?tl)) { + alt (f(hd)) { + case (none[U]) { + // FIXME: should use 'be' here, not 'ret'. But parametric + // tail calls currently don't work. + ret find[T,U](*tl, f); + } + case (some[U](?res)) { + ret some[U](res); + } } } + case (nil[T]) { + ret none[U]; + } } - case (nil[T]) { - ret none[U]; - } - } - fail; // TODO: remove me when exhaustiveness checking works + fail; // TODO: remove me when exhaustiveness checking works } fn length[T](&list[T] ls) -> uint { - fn count[T](&T t, &uint u) -> uint { - ret u + 1u; - } - ret foldl[T,uint](ls, 0u, bind count[T](_, _)); + fn count[T](&T t, &uint u) -> uint { + ret u + 1u; + } + ret foldl[T,uint](ls, 0u, bind count[T](_, _)); } fn cdr[T](&list[T] ls) -> list[T] {