JCumin/Brachylog

Appending to empty list does some weird stuff

UnrelatedString opened this issue · 2 comments

[],_1 unifies the following variable with 1 rather than the expected [_1]. In general, trying to append a value to an empty list produces that value, rather than that value wrapped in a list, unless that value is a negative number: bizarrely, if the value is a negative integer, the result is its absolute value, and if the value is a negative non-integer, then the result is the value wrapped in a list as expected. Everything is fine if the list is non-empty. There is something really weird going on here.

(This came up as I was trying to write my solution for this Code Golf SE challenge as {f,_1↻₂t}ˢ before eventually arriving at {fkt|∧_1}ˢ.)

Just tried it, definitely weird. I'll try to have a look at it.

@UnrelatedString Should be fixed as of this commit (this will get pulled on TryItOnline shortly). Hopefully I have not introduced new bugs with this…