let rec v_cos v = match v with
        |N i -> return_R (cos (float_of_int i))
        |R f -> return_R (cos f)
        |Vec (size, vec) -> make_vector size (fun i -> v_cos (vec i))
        |Zero -> return_R (cos 0.)
        |W -> W