Fork a stream in multiple directions according to a function