diff options
| -rw-r--r-- | src/lem_interp/interp_lib.lem | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lem_interp/interp_lib.lem b/src/lem_interp/interp_lib.lem index e6c06019..efccc9bb 100644 --- a/src/lem_interp/interp_lib.lem +++ b/src/lem_interp/interp_lib.lem @@ -54,10 +54,12 @@ let rec add (V_tuple args) = match args with (if d then to_vec_inc else to_vec_dec) len (V_lit (L_aux (L_num (x+y)) lx)) (* integer case *) | [V_lit(L_aux (L_num x) lx); V_lit(L_aux (L_num y) ly)] -> V_lit(L_aux (L_num (x+y)) lx) - | [(V_lit(L_aux (L_num _) _) as n); (V_vector len d _ as v)] -> - add (V_tuple [(if d then to_vec_inc else to_vec_dec) (natFromNatural len) n; v]) - | [(V_vector len d _ as v); (V_lit(L_aux (L_num _) _) as n)] -> - add (V_tuple [v; (if d then to_vec_inc else to_vec_dec) (natFromNatural len) n]) + | [(V_lit(L_aux (L_num _) _) as n); (V_vector _ d l as v)] -> + let len = List.length l in + add (V_tuple [(if d then to_vec_inc else to_vec_dec) len n; v]) + | [(V_vector _ d l as v); (V_lit(L_aux (L_num _) _) as n)] -> + let len = List.length l in + add (V_tuple [v; (if d then to_vec_inc else to_vec_dec) len n]) (* assume other literals are L_bin or L_hex, ie. vectors *) | [V_lit l; x ] -> add (V_tuple [litV_to_vec l; x]) | [ x ; V_lit l ] -> add (V_tuple [x; litV_to_vec l]) |
