Skip to content

Commit 1e9aef8

Browse files
committed
stdlib: Reindent list.rs
1 parent d4f5f69 commit 1e9aef8

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

src/lib/list.rs

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,49 +11,49 @@ tag list[T] {
1111
}
1212

1313
fn foldl[T,U](&list[T] ls, &U u, fn(&T t, &U u) -> U f) -> U {
14-
alt(ls) {
15-
case (cons[T](?hd, ?tl)) {
16-
auto u_ = f(hd, u);
17-
// FIXME: should use 'be' here, not 'ret'. But parametric
18-
// tail calls currently don't work.
19-
ret foldl[T,U](*tl, u_, f);
20-
}
21-
case (nil[T]) {
22-
ret u;
14+
alt(ls) {
15+
case (cons[T](?hd, ?tl)) {
16+
auto u_ = f(hd, u);
17+
// FIXME: should use 'be' here, not 'ret'. But parametric
18+
// tail calls currently don't work.
19+
ret foldl[T,U](*tl, u_, f);
20+
}
21+
case (nil[T]) {
22+
ret u;
23+
}
2324
}
24-
}
2525

26-
fail; // TODO: remove me when exhaustiveness checking works
26+
fail; // TODO: remove me when exhaustiveness checking works
2727
}
2828

2929
fn find[T,U](&list[T] ls,
3030
(fn(&T) -> option::t[U]) f) -> option::t[U] {
31-
alt(ls) {
32-
case (cons[T](?hd, ?tl)) {
33-
alt (f(hd)) {
34-
case (none[U]) {
35-
// FIXME: should use 'be' here, not 'ret'. But parametric tail
36-
// calls currently don't work.
37-
ret find[T,U](*tl, f);
38-
}
39-
case (some[U](?res)) {
40-
ret some[U](res);
31+
alt(ls) {
32+
case (cons[T](?hd, ?tl)) {
33+
alt (f(hd)) {
34+
case (none[U]) {
35+
// FIXME: should use 'be' here, not 'ret'. But parametric
36+
// tail calls currently don't work.
37+
ret find[T,U](*tl, f);
38+
}
39+
case (some[U](?res)) {
40+
ret some[U](res);
41+
}
4142
}
4243
}
44+
case (nil[T]) {
45+
ret none[U];
46+
}
4347
}
44-
case (nil[T]) {
45-
ret none[U];
46-
}
47-
}
4848

49-
fail; // TODO: remove me when exhaustiveness checking works
49+
fail; // TODO: remove me when exhaustiveness checking works
5050
}
5151

5252
fn length[T](&list[T] ls) -> uint {
53-
fn count[T](&T t, &uint u) -> uint {
54-
ret u + 1u;
55-
}
56-
ret foldl[T,uint](ls, 0u, bind count[T](_, _));
53+
fn count[T](&T t, &uint u) -> uint {
54+
ret u + 1u;
55+
}
56+
ret foldl[T,uint](ls, 0u, bind count[T](_, _));
5757
}
5858

5959
fn cdr[T](&list[T] ls) -> list[T] {

0 commit comments

Comments
 (0)