I think 'break' is not breaking lists properly
prozacchiwawa opened this issue · 2 comments
Do I understand the operation of break correctly?
I think this demonstrates a bug in List.
-- Test --
testList : List(Int)
testList = nil 0 cons 1 cons 2 cons
testList 0 nat break dip(len? swap drop) len? swap drop == 0 nat 3 nat
testList 3 nat break dip(len? swap drop) len? swap drop == 3 nat 0 nat
testList 4 nat break dip(len? swap drop) len? swap drop == 3 nat 0 nat
testList 1 nat break dip(len? swap drop) len? swap drop == 1 nat 2 nat
ValueError: Assertion failed at line 7: input = [], LHS = [('_nat', 3) ('_nat', 0)], RHS = [('_nat', 1) ('_nat', 2)].
testList 2 nat break dip(len? swap drop) len? swap drop == 2 nat 1 nat
Definitely a bug! I'm taking a look.
Fixed now! The definition of n<=
was wrong, which caused break
to be wrong.
Thanks for finding this.