Make first(g) more efficient: extract only 1 value
first(g) was extracting two values, which, if g is slow, made first(g) slow. And if the second extraction were to throw an error, then first(g) would throw that error, which is clearly not the right thing to do. Besides that, first(g) was allocating garbage, which it no longer does.
This commit is contained in:
1 parent
e24af3c78e
commit
396543191c
2 files changed
+6
-1
No files matched your search
@@ -303,6 +303,11 @@ null
|
||||
10
|
||||
[0,9,0,5,"nth doesn't support negative indices"]
|
||||
|
||||
# Check that first(g) does not extract more than one value from g
|
||||
first(1,error("foo"))
|
||||
null
|
||||
1
|
||||
|
||||
#
|
||||
# Check that various builtins evalute all arguments where appropriate,
|
||||
# doing cartesian products where appropriate.
|
||||
|
||||
Reference in new issue
Block a user