A fixed point theorem for function spaces