diff options
author | NanoTech | 2016-12-12 02:24:15 +0000 |
---|---|---|
committer | NanoTech | 2017-03-10 23:48:29 -0600 |
commit | eca97e7b04ce5c02ffeef3fa0f1c4da5c4d25a26 (patch) | |
tree | 4d67340f051f98659bb96ae6039f469acc53060b | |
parent | 490070cbb26d0853c6011407d8d72f0075fd7322 (diff) |
Fix context lookup order
The most recent item, with context index 0, is at
the end of the Vec.
-rw-r--r-- | src/context.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/context.rs b/src/context.rs index b72182d..9fb3bf4 100644 --- a/src/context.rs +++ b/src/context.rs @@ -30,7 +30,7 @@ impl<'i, T> Context<'i, T> { /// lookup k n (insert j v c) = lookup k n c -- k /= j /// ``` pub fn lookup<'a>(&'a self, k: &str, n: usize) -> Option<&'a T> { - self.0.get(k).and_then(|v| v.get(n)) + self.0.get(k).and_then(|v| v.get(v.len() - 1 - n)) } pub fn map<U, F: Fn(&T) -> U>(&self, f: F) -> Context<'i, U> { |