diff options
Diffstat (limited to 'src/lem_interp/interp.lem')
| -rw-r--r-- | src/lem_interp/interp.lem | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/src/lem_interp/interp.lem b/src/lem_interp/interp.lem index a57c71a4..854ed202 100644 --- a/src/lem_interp/interp.lem +++ b/src/lem_interp/interp.lem @@ -282,27 +282,19 @@ let access_vector v n = else list_nth vs (m - n) end -val from_n_to_n :forall 'a. natural -> natural -> natural -> list 'a -> list 'a -let rec from_n_to_n from to_ acc ls = - match ls with - | [] -> [] - | l::ls -> - if from > acc - then from_n_to_n from to_ acc ls - else if from = to_ - then [l] - else l::(from_n_to_n from to_ acc ls) -end - -(*Needs debugging*) +val from_n_to_n :forall 'a. natural -> natural -> list 'a -> list 'a +let from_n_to_n from to_ ls = + let from = natFromNatural from in + let to_ = natFromNatural to_ in + take (to_ - from + 1) (drop from ls) val slice_vector : value -> natural -> natural -> value let slice_vector v n1 n2 = match v with | V_vector m inc vs -> if inc - then V_vector n1 inc (from_n_to_n (n1 - m) (n2 - m) 0 vs) - else V_vector n1 inc (from_n_to_n (m - n1) (m - n2) 0 vs) + then V_vector n1 inc (from_n_to_n (n1 - m) (n2 - m) vs) + else V_vector n1 inc (from_n_to_n (m - n1) (m - n2) vs) end val update_field_list : list (id * value) -> list (id * value) -> list (id * value) |
