Single item arrays
Closed this issue · 2 comments
Using '(' ')' to represent arrays of length 1 does not work and returns the item inside the array instead.
Example usecase:
equals(account_numbers, ("1"))
the function receives 1.
When adding another value to the list, for example ("1", "2")
The function receives [1, 2] as expected.
(equals is a custom function)
Hey Ron!
Filtrex is intended to be understandable by non-programmers and laymen. Because of this, Filtrex treats arrays with length one as just a value on many places – because from the user's perspective both represent one value and the difference between them is technical, rather than semantical. The "fluent" way to handle this would be to do the same in the functions you provide to Filtrex.
Also, rather than providing an equals
function, you can simply override the equals operator to make the expression more readable.
Hey Ron! Filtrex is intended to be understandable by non-programmers and laymen. Because of this, Filtrex treats arrays with length one as just a value on many places – because from the user's perspective both represent one value and the difference between them is technical, rather than semantical. The "fluent" way to handle this would be to do the same in the functions you provide to Filtrex. Also, rather than providing an
equals
function, you can simply override the equals operator to make the expression more readable.
Thank you for the detailed response. I guess I expected consistency from the programming side but the way you explained it kinda made sense. Thanks!