Skip to content

Commit 04769c4

Browse files
committed
---
yaml --- r: 6094 b: refs/heads/master c: d8d35e7 h: refs/heads/master v: v3
1 parent 69c0718 commit 04769c4

File tree

6 files changed

+19
-20
lines changed

6 files changed

+19
-20
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: d58a9c73464133f95663bf5e78bb693ffb5de284
2+
refs/heads/master: d8d35e7c400fe0140de128a41d4b9f2ff7a3735b

trunk/src/comp/middle/resolve.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -356,11 +356,10 @@ fn visit_block_with_scope(b: ast::blk, sc: scopes, v: vt<scopes>) {
356356
}
357357

358358
fn visit_decl_with_scope(d: @decl, sc: scopes, v: vt<scopes>) {
359-
let loc_pos =
360-
alt list::car(sc) {
361-
scope_block(_, _, pos) { pos }
362-
_ { @mutable 0u }
363-
};
359+
let loc_pos = alt list::head(sc) {
360+
scope_block(_, _, pos) { pos }
361+
_ { @mutable 0u }
362+
};
364363
alt d.node {
365364
decl_local(locs) {
366365
for (_, loc) in locs { v.visit_local(loc, sc, v);; *loc_pos += 1u; }

trunk/src/lib/list.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -105,20 +105,20 @@ fn len<T>(ls: list<T>) -> uint {
105105
}
106106

107107
/*
108-
Function: cdr
108+
Function: tail
109109
110110
Returns all but the first element of a list
111111
*/
112-
fn cdr<T>(ls: list<T>) -> list<T> {
112+
fn tail<T>(ls: list<T>) -> list<T> {
113113
alt ls { cons(_, tl) { ret *tl; } nil. { fail "list empty" } }
114114
}
115115

116116
/*
117-
Function: car
117+
Function: head
118118
119119
Returns the first element of a list
120120
*/
121-
fn car<T>(ls: list<T>) -> T {
121+
fn head<T>(ls: list<T>) -> T {
122122
alt ls { cons(hd, _) { ret hd; } nil. { fail "list empty" } }
123123
}
124124

trunk/src/test/run-pass/non-boolean-pure-fns.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pure fn nonempty_list<T>(ls: list<T>) -> bool { pure_length(ls) > 0u }
1414
// knowledge that ls is a cons node. Future work.
1515
// Also, this is pretty contrived since nonempty_list
1616
// could be a "tag refinement", if we implement those.
17-
fn safe_head<T>(ls: list<T>) : nonempty_list(ls) -> T { car(ls) }
17+
fn safe_head<T>(ls: list<T>) : nonempty_list(ls) -> T { head(ls) }
1818

1919
fn main() {
2020
let mylist = cons(@1u, @nil);

trunk/src/test/run-pass/unchecked-predicates.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pure fn nonempty_list<T>(ls: list<T>) -> bool { pure_length(ls) > 0u }
2222
// knowledge that ls is a cons node. Future work.
2323
// Also, this is pretty contrived since nonempty_list
2424
// could be a "tag refinement", if we implement those.
25-
fn safe_head<T>(ls: list<T>) : nonempty_list(ls) -> T { car(ls) }
25+
fn safe_head<T>(ls: list<T>) : nonempty_list(ls) -> T { head(ls) }
2626

2727
fn main() {
2828
let mylist = cons(@1u, @nil);

trunk/src/test/stdtest/list.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11

22
use std;
33
import std::list;
4-
import std::list::car;
5-
import std::list::cdr;
4+
import std::list::head;
5+
import std::list::tail;
66
import std::list::from_vec;
77
import std::option;
88

99
#[test]
1010
fn test_from_vec() {
1111
let l = from_vec([0, 1, 2]);
12-
assert (car(l) == 0);
13-
assert (car(cdr(l)) == 1);
14-
assert (car(cdr(cdr(l))) == 2);
12+
assert (head(l) == 0);
13+
assert (head(tail(l)) == 1);
14+
assert (head(tail(tail(l))) == 2);
1515
}
1616

1717
#[test]
1818
fn test_from_vec_mut() {
1919
let l = from_vec([mutable 0, 1, 2]);
20-
assert (car(l) == 0);
21-
assert (car(cdr(l)) == 1);
22-
assert (car(cdr(cdr(l))) == 2);
20+
assert (head(l) == 0);
21+
assert (head(tail(l)) == 1);
22+
assert (head(tail(tail(l))) == 2);
2323
}
2424

2525
#[test]

0 commit comments

Comments
 (0)