I found this when debugging a corner case in the solve24 module and I was able to trace it down to a call to baseN([], n) which results in [] rather than the expected [[]]. Here's an example to help explain: let's say we want to generate all possible ways to perform some set ops of binary operations (like +,-,*,/) on ops.length+1 numbers. To do so, one might call baseN(ops, ops.length) to find all ops.length-size combinations of ops for applying to the ops.length+1 numbers. However, in the case that ops is empty, there is still exactly one possible combination of ops, namely itself. The current, incorrect behavior of baseN([], n) returning [] should be changed to return [[]] instead.
I found this when debugging a corner case in the solve24 module and I was able to trace it down to a call to
baseN([], n)
which results in[]
rather than the expected[[]]
. Here's an example to help explain: let's say we want to generate all possible ways to perform some setops
of binary operations (like +,-,*,/) onops.length+1
numbers. To do so, one might callbaseN(ops, ops.length)
to find allops.length
-size combinations ofops
for applying to theops.length+1
numbers. However, in the case thatops
is empty, there is still exactly one possible combination ofops
, namely itself. The current, incorrect behavior ofbaseN([], n)
returning[]
should be changed to return[[]]
instead.