From 2dbfd51f1539998495b93825b7e766b7cce0affd Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Thu, 15 Oct 2015 11:45:40 -0400 Subject: [PATCH] Recur through pairs of `.Keyed` nodes with equal keys. --- prototype/Doubt/Interpreter.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/prototype/Doubt/Interpreter.swift b/prototype/Doubt/Interpreter.swift index aec1cb0a9..d11a5eb65 100644 --- a/prototype/Doubt/Interpreter.swift +++ b/prototype/Doubt/Interpreter.swift @@ -29,6 +29,9 @@ public struct Interpreter { case let (.Indexed(a), .Indexed(b)) where a.count == b.count: return recur(f(.Indexed(zip(a, b).map(run)))) + case let (.Keyed(a), .Keyed(b)) where Array(a.keys) == Array(b.keys): + return recur(f(.Keyed(Dictionary(elements: b.keys.map { ($0, self.run(a[$0]!, b[$0]!)) })))) + default: return nil }