aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorMarijn Haverbeke <[email protected]>2011-05-09 12:40:09 +0200
committerMarijn Haverbeke <[email protected]>2011-05-11 12:32:37 +0200
commite9c12ab1d019b42e5427e31bfa49f1f799e84165 (patch)
tree7f7ce69c7619060559d2da99fb78fa49c4467aa6 /src/lib
parentReuse a single work buffer every time the SHA1 message block is processed. (diff)
downloadrust-e9c12ab1d019b42e5427e31bfa49f1f799e84165.tar.xz
rust-e9c12ab1d019b42e5427e31bfa49f1f799e84165.zip
Rewrite comp/middle/resolve.rs
* Cleans up the algorithm * Move first pass to walk (second still folds) * Support part of a type/value namespace split (crate metadata and module indices still need to be taught about this) * Remove a few blatant inefficiencies (import tables being recreated for every lookup, most importantly)
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/List.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/lib/List.rs b/src/lib/List.rs
index 58ea29f2..6d7748f0 100644
--- a/src/lib/List.rs
+++ b/src/lib/List.rs
@@ -56,6 +56,17 @@ fn length[T](&list[T] ls) -> uint {
ret foldl[T,uint](ls, 0u, bind count[T](_, _));
}
+fn cdr[T](&list[T] ls) -> list[T] {
+ alt (ls) {
+ case (cons[T](_, ?tl)) {ret *tl;}
+ }
+}
+fn car[T](&list[T] ls) -> T {
+ alt (ls) {
+ case (cons[T](?hd, _)) {ret hd;}
+ }
+}
+
// Local Variables:
// mode: rust;
// fill-column: 78;