pysearch icon indicating copy to clipboard operation
pysearch copied to clipboard

Imperfect handling of short-circuiting for logical operators

Open Lydxn opened this issue 1 year ago • 0 comments

The implementation for logical operators like or and and do not fully account for their short-circuiting behaviors. For example, the expression x<1 or 1//x should return 1 for x=0, but pysearch cannot find it because 1//x is immediately pruned due to a division by zero.

The way to deal with this is to make Num an Option<Num> and allow errors to be represented as None instead of pruning them entirely. Fixing this will likely hurt performance, so we would probably want to implement this as an optional flag in params.rs.

Doing this would also allow None outputs, which might be useful if the user wants a certain input to throw an error (termination by error is common in code golf :).

Lydxn avatar Jan 05 '24 08:01 Lydxn