aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/primops.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libexpr/primops.cc')
-rw-r--r--src/libexpr/primops.cc18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index b0986028e..5736a7f91 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -414,17 +414,13 @@ static Expr primIsNull(EvalState & state, const ATermVector & args)
static Expr primMap(EvalState & state, const ATermVector & args)
{
Expr fun = evalExpr(state, args[0]);
- Expr list = evalExpr(state, args[1]);
+ ATermList list = evalList(state, args[1]);
- ATermList list2;
- if (!matchList(list, list2))
- throw Error("`map' expects a list as its second argument");
-
- ATermList list3 = ATempty;
- for (ATermIterator i(list2); i; ++i)
- list3 = ATinsert(list3, makeCall(fun, *i));
+ ATermList res = ATempty;
+ for (ATermIterator i(list); i; ++i)
+ res = ATinsert(res, makeCall(fun, *i));
- return makeList(ATreverse(list3));
+ return makeList(ATreverse(res));
}
@@ -449,9 +445,7 @@ static Expr primRemoveAttrs(EvalState & state, const ATermVector & args)
ATermMap attrs;
queryAllAttrs(evalExpr(state, args[0]), attrs, true);
- ATermList list;
- if (!matchList(evalExpr(state, args[1]), list))
- throw Error("`removeAttrs' expects a list as its second argument");
+ ATermList list = evalList(state, args[1]);
for (ATermIterator i(list); i; ++i)
/* It's not an error for *i not to exist. */