You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice to be able to write rules for list literals with any number of elements. For example, consider the following rule:
- warn:
lhs: '[x] ++ [y]'rhs: '[x, y]'
As written, they only work with singleton lists. I could write additional rules for lists of various sizes. That quickly gets out of hand and isn't exhaustive anyway. What I would like to be able to do is write a rule like this:
And so on. Perhaps the cases with empty lists would need to be handled separately.
I tried doing something like { lhs: [x] ++ y, side: isList y } which didn't work. I also tried { side: 'is[] y' }, but that errored out. Even if that condition worked, there would be no way for me to "unpack" the list literal anyway; it would end up suggesting [x, [y]].
The text was updated successfully, but these errors were encountered:
It would be nice to be able to write rules for list literals with any number of elements. For example, consider the following rule:
As written, they only work with singleton lists. I could write additional rules for lists of various sizes. That quickly gets out of hand and isn't exhaustive anyway. What I would like to be able to do is write a rule like this:
And have that match for all the following cases:
And so on. Perhaps the cases with empty lists would need to be handled separately.
I tried doing something like
{ lhs: [x] ++ y, side: isList y }
which didn't work. I also tried{ side: 'is[] y' }
, but that errored out. Even if that condition worked, there would be no way for me to "unpack" the list literal anyway; it would end up suggesting[x, [y]]
.The text was updated successfully, but these errors were encountered: