aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Hinder <ian.hinder@aei.mpg.de>2011-09-18 19:56:08 +0200
committerIan Hinder <ian.hinder@aei.mpg.de>2011-09-18 19:56:08 +0200
commitb6b5794f283ca0f973418813139f9187324e2015 (patch)
tree936ebf20bbad5e896cc17f129a92ec4537df839e
parenta11a7805e5269cffab4cc9694e7c60810f27dd0c (diff)
MapLookup.m: Allow third argument to lookup to specify default
-rw-r--r--Tools/MathematicaMisc/MapLookup.m3
1 files changed, 3 insertions, 0 deletions
diff --git a/Tools/MathematicaMisc/MapLookup.m b/Tools/MathematicaMisc/MapLookup.m
index faa553c..7c3153a 100644
--- a/Tools/MathematicaMisc/MapLookup.m
+++ b/Tools/MathematicaMisc/MapLookup.m
@@ -27,6 +27,9 @@ VerifyMap[m_] :=
ThrowError["Expecting a map (list of rules) but found", m]];
Map[VerifyRule, m]];
+lookup[map_, key_, default_] :=
+ lookupDefault[map, key, default];
+
lookup[map_, key_] :=
Module[{values},
VerifyMap[map];