add a function to iterate an action over cursors