aboutsummaryrefslogtreecommitdiff
path: root/neb/std/core.py
diff options
context:
space:
mode:
Diffstat (limited to 'neb/std/core.py')
-rw-r--r--neb/std/core.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/neb/std/core.py b/neb/std/core.py
index 9a9e56d..ea80d86 100644
--- a/neb/std/core.py
+++ b/neb/std/core.py
@@ -126,15 +126,18 @@ def interpretDropWhile(symbol, args, env, ns):
ev = None
which_idx = None
for idx, item in enumerate(coll.args):
- which_idx = idx
new_env.register("_item_", evaluate(item, env, ns))
for arg in args[1:]:
ev = evaluate(arg, new_env, ns)
if not isinstance(ev, Bool):
raise InterpretPanic(symbol, "condition must evaluate to a :bool", ev)
if ev.value is False:
+ which_idx = idx
break
- return List(coll.args[which_idx:])
+ if which_idx is not None:
+ return List(coll.args[which_idx:])
+ else:
+ return List([])
CORE.register("drop-while", NebSyntax("drop-while", interpretDropWhile, [for_each_arg, for_body_arg], for_body_arg))