Suppose pred = x => x % 3 == 0
We abstract away the predicate, to make the example clearer.
3
/ \
1 5 .filterAux( Empty )
\ / \
2 4 6
5 1
/ \ .filterAux( \ .filterAux(Empty))
4 6 2
5
/ \ .filterAux(Empty.filterAux((2.filterAux(Empty)).ins(1)))
4 6
5
/ \ .filterAux(Empty.filterAux((Empty.filterAux((Empty.filterAux(Empty)).ins(2)).ins(1)))
4 6
5
/ \ .filterAux(Empty.filterAux((Empty.filterAux(Empty.ins(2)).ins(1)))
4 6
5
/ \ .filterAux(Empty.filterAux((Empty.filterAux( 2 ).ins(1)))
4 6
5
/ \ .filterAux(Empty.filterAux( 2 .ins(1)))
4 6
5 2
/ \ .filterAux(Empty.filterAux( / ))
4 6 1
5 2
/ \ .filterAux( / )
4 6 1
2
4.filterAux( (6.filterAux( / )).ins(5) )
1
2
4.filterAux( (Empty.filterAux(Empty.filterAux( / ))).ins(5) )
1
2
4.filterAux( (Empty.filterAux( / )).ins(5) )
1
2
4.filterAux(( / ).ins(5) )
1
2
4.filterAux( / \ )
1 5
2
Empty.filterAux((Empty.filterAux( / \ )).ins(4))
1 5
2
Empty.filterAux(( / \ ).ins(4))
1 5
2
Empty.filterAux( / \ )
1 5
/
4
2
/ \
1 5
/
4