aboutsummaryrefslogtreecommitdiff
path: root/cs
diff options
context:
space:
mode:
authorJoel Martin <github@martintribe.org>2014-04-15 01:24:43 -0500
committerJoel Martin <github@martintribe.org>2014-04-15 01:24:43 -0500
commit7e9a2883fe5c25a521b1dc37e4c549e1ed508ece (patch)
treeb444224dae6db978d4b5902f2a5b37046ba40d3e /cs
parenta2849f89e7892feee256169398b1d2d82a2b8231 (diff)
downloadmal-7e9a2883fe5c25a521b1dc37e4c549e1ed508ece.tar.gz
mal-7e9a2883fe5c25a521b1dc37e4c549e1ed508ece.zip
All: fix get. All pass stepA tests.
Diffstat (limited to 'cs')
-rw-r--r--cs/core.cs8
1 files changed, 6 insertions, 2 deletions
diff --git a/cs/core.cs b/cs/core.cs
index f8bd7ff..13f082e 100644
--- a/cs/core.cs
+++ b/cs/core.cs
@@ -87,8 +87,12 @@ namespace Mal {
static MalFunction get = new MalFunction(
a => {
string key = ((MalString)a[1]).getValue();
- var dict = ((MalHashMap)a[0]).getValue();
- return dict.ContainsKey(key) ? dict[key] : Nil;
+ if (a[0] == Nil) {
+ return Nil;
+ } else {
+ var dict = ((MalHashMap)a[0]).getValue();
+ return dict.ContainsKey(key) ? dict[key] : Nil;
+ }
});
static MalFunction keys = new MalFunction(