implement direction alternating scan - scanAlt(dirs, fn)