I'm looking to filter a traversal, then select the last element to use with over
.
e.g. something like this (but which will actually compile):
[1,2,3,4] & traverse . filtered even . _last +~ 10
> [1,2,3,14]
Any ideas?
P.S. I'm aware that filtered
is only valid when not affecting the number of elements in the traversal.
The actual use case I'm performing is to select only the lowest level of a recursive uniplate
traversal that matches some predicate; if you have other ideas of how to do this I'd love to hear them!