1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-27 04:30:59 +01:00

* A primop for calling functions strictly (i.e. forcing evaluation of

argument).  Necessary to actually get memoisation of functions like
  "fib" with maximal laziness.
This commit is contained in:
Eelco Dolstra 2007-10-11 14:06:43 +00:00
parent 8e0488370d
commit 3d14ed9270

View file

@ -927,6 +927,17 @@ static Expr prim_stringLength(EvalState & state, const ATermVector & args)
}
/*************************************************************
* Strictness
*************************************************************/
static Expr prim_strict(EvalState & state, const ATermVector & args)
{
return evalExpr(state, makeCall(args[0], evalExpr(state, args[1])));
}
/*************************************************************
* Primop registration
*************************************************************/
@ -993,6 +1004,9 @@ void EvalState::addPrimOps()
addPrimOp("toString", 1, prim_toString);
addPrimOp("__substring", 3, prim_substring);
addPrimOp("__stringLength", 1, prim_stringLength);
// Strictness
addPrimOp("strict", 2, prim_strict);
}