List of steps to reproduce (step by step, including full links if applicable):
- Need to have a function empty string. It is implemented as a composition of is empty(string to list(x)).
- Then I call if(empty string("x"), "a", if(empty string(""), "b", "c"))
What happens?:
"c"
What should have happened instead?:
"b"
If I replace empty string with the composition, it works fine:
if(is empty(string to list("x")), "a", if(is empty(string to list("")), "b", "c"))
returns "b", as expected.
Here are the relevant JSON object. Feel free to ask for more.
My definition of empty string:
{ "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z10016" }, "Z2K2": { "Z1K1": "Z8", "Z8K1": [ { "Z1K1": "Z17", "Z17K1": "Z6", "Z17K2": { "Z1K1": "Z6", "Z6K1": "Z10016K1" }, "Z17K3": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "input" } ] } } ], "Z8K2": "Z40", "Z8K3": [ "Z10017", "Z10018", "Z10019" ], "Z8K4": [ "Z10020" ], "Z8K5": "Z10016" }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Empty string" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ { "Z1K1": "Z31", "Z31K1": "Z1002", "Z31K2": [] } ] } }
The implementation of string to list:
{ "Z1K1": "Z2", "Z2K1": { "Z1K1": "Z6", "Z6K1": "Z10020" }, "Z2K2": { "Z1K1": "Z14", "Z14K1": "Z10016", "Z14K2": { "Z1K1": "Z7", "Z7K1": "Z813", "Z813K1": { "Z1K1": "Z7", "Z7K1": "Z868", "Z868K1": { "Z1K1": "Z18", "Z18K1": { "Z1K1": "Z6", "Z6K1": "Z10016K1" } } } } }, "Z2K3": { "Z1K1": "Z12", "Z12K1": [ { "Z1K1": "Z11", "Z11K1": "Z1002", "Z11K2": "Empty string as empty list" } ] }, "Z2K4": { "Z1K1": "Z32", "Z32K1": [ { "Z1K1": "Z31", "Z31K1": "Z1002", "Z31K2": [] } ] } }
Function call if(empty string("x"), "a", if(empty string(""), "b", "c"))
{ "Z1K1": { "Z1K1": "Z9", "Z9K1": "Z7" }, "Z7K1": { "Z1K1": "Z9", "Z9K1": "Z802" }, "Z802K1": { "Z1K1": { "Z1K1": "Z9", "Z9K1": "Z7" }, "Z7K1": { "Z1K1": "Z9", "Z9K1": "Z10016" }, "Z10016K1": { "Z1K1": "Z6", "Z6K1": "x" } }, "Z802K2": { "Z1K1": "Z6", "Z6K1": "a" }, "Z802K3": { "Z1K1": { "Z1K1": "Z9", "Z9K1": "Z7" }, "Z7K1": { "Z1K1": "Z9", "Z9K1": "Z802" }, "Z802K1": { "Z1K1": { "Z1K1": "Z9", "Z9K1": "Z7" }, "Z7K1": { "Z1K1": "Z9", "Z9K1": "Z10016" }, "Z10016K1": { "Z1K1": "Z6", "Z6K1": "" } }, "Z802K2": { "Z1K1": "Z6", "Z6K1": "b" }, "Z802K3": { "Z1K1": "Z6", "Z6K1": "c" } } }
Function call if(is empty(string to list("x")), "a", if(is empty(string to list("")), "b", "c"))
{ "Z1K1": { "Z1K1": "Z9", "Z9K1": "Z7" }, "Z7K1": { "Z1K1": "Z9", "Z9K1": "Z802" }, "Z802K1": { "Z1K1": { "Z1K1": "Z9", "Z9K1": "Z7" }, "Z7K1": { "Z1K1": "Z9", "Z9K1": "Z813" }, "Z813K1": { "Z1K1": { "Z1K1": "Z9", "Z9K1": "Z7" }, "Z7K1": { "Z1K1": "Z9", "Z9K1": "Z868" }, "Z868K1": { "Z1K1": "Z6", "Z6K1": "x" } } }, "Z802K2": { "Z1K1": "Z6", "Z6K1": "a" }, "Z802K3": { "Z1K1": { "Z1K1": "Z9", "Z9K1": "Z7" }, "Z7K1": { "Z1K1": "Z9", "Z9K1": "Z802" }, "Z802K1": { "Z1K1": { "Z1K1": "Z9", "Z9K1": "Z7" }, "Z7K1": { "Z1K1": "Z9", "Z9K1": "Z813" }, "Z813K1": { "Z1K1": { "Z1K1": "Z9", "Z9K1": "Z7" }, "Z7K1": { "Z1K1": "Z9", "Z9K1": "Z868" }, "Z868K1": { "Z1K1": "Z6", "Z6K1": "" } } }, "Z802K2": { "Z1K1": "Z6", "Z6K1": "b" }, "Z802K3": { "Z1K1": "Z6", "Z6K1": "c" } } }
Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc.:
As of Friday, May 20, 2022
This seems a regression. I ran into this issue when I tried to call my composition of add(x, y) which is defined as if(is zero(y), x, add(successor(x), floored predecessor(y)), which used to work previously.