diff --git a/src/functions.cpp b/src/functions.cpp index ee7fe5e..b467127 100644 --- a/src/functions.cpp +++ b/src/functions.cpp @@ -662,6 +662,7 @@ ADD_FUNCTION( return result; }); +// (assoc {:a 1 :b 2} :a 3 :c 1) ADD_FUNCTION( "assoc", { @@ -698,11 +699,17 @@ ADD_FUNCTION( return result; }); +// (get {:kw "value"} :kw) ADD_FUNCTION( "get", { CHECK_ARG_COUNT_AT_LEAST("get", nodes.size(), 1); + if (is(nodes.front().get()) + && std::static_pointer_cast(nodes.front())->state() == Constant::Nil) { + return makePtr(); + } + VALUE_CAST(hash_map, HashMap, nodes.front()); nodes.pop_front();