Closed orlade-anz closed 4 years ago
Dumb workaround:
let safetuple = \d
let empty = d('')?:{};
let rest = //tuple(d without (@:'', @value:empty));
cond {
empty: rest +> ('': empty),
_: rest,
}
;
The workaround doesn't handle dicts where the ''
key holds a falsy value. Here's a safer version:
let safetuple = \d
let rest = //tuple(d where .@ != '');
cond d where .@ = '' {
{(@:'', @value: value)}: rest +> (@: value),
_: rest,
};
Please do not post any internal, closed source snippets on this public issue tracker!
Description
//tuple(dict)
converts a dict to a tuple. However if one of the dict's keys is an empty string, it panics.Steps to Reproduce
arrai eval '//tuple({"": 1})'
Expected behavior
('': 1)
Actual behavior
Your Environment