3 ms·
> The closest you can go is this, but having an explicit rightward assignment: > > events.select { _1 => type:, role:; type == 'create' || role == 'admin'
by ezekg 3y ago
> The closest you can go is this, but having an explicit rightward assignment:
>
> events.select { _1 => type:, role:; type == 'create' || role == 'admin' }
I'd actually recommend using in instead:
events.select { _1 in {type: 'create'} | {role: 'admin'} }
I really enjoy using in for filtering. But I get the OP's point.
Pattern matching does need QOL improvements to really feel like it's a first-class citizen of the language ... like patterning matching for method and block arguments. :)