From eca97e7b04ce5c02ffeef3fa0f1c4da5c4d25a26 Mon Sep 17 00:00:00 2001 From: NanoTech Date: Mon, 12 Dec 2016 02:24:15 +0000 Subject: Fix context lookup order The most recent item, with context index 0, is at the end of the Vec.--- src/context.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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>(&self, f: F) -> Context<'i, U> { -- cgit v1.2.3