apply function f to captured data