#[legacy_modes];
use dvec::DVec;
type entry = {key: A, value: B};
type alist = { eq_fn: fn@(A,A) -> bool, data: DVec> };
fn alist_add(lst: alist, k: A, v: B) {
lst.data.push({key:k, value:v});
}
fn alist_get(lst: alist, k: A) -> B {
let eq_fn = lst.eq_fn;
for lst.data.each |entry| {
if eq_fn(entry.key, k) { return entry.value; }
}
fail;
}
#[inline]
fn new_int_alist() -> alist {
fn eq_int(&&a: int, &&b: int) -> bool { a == b }
return {eq_fn: eq_int, data: DVec()};
}
#[inline]
fn new_int_alist_2() -> alist {
#[inline]
fn eq_int(&&a: int, &&b: int) -> bool { a == b }
return {eq_fn: eq_int, data: DVec()};
}