Michelson: remove instruction MAP on sets

This commit is contained in:
Benjamin Canou 2018-01-26 16:46:25 +01:00
parent 024738e0b6
commit 3d0ec5deb4
4 changed files with 0 additions and 39 deletions

View File

@ -838,24 +838,6 @@ Operations on sets
:: 'elt : bool : set 'elt : 'S -> set 'elt : 'S
- ``MAP``: Apply a function on a map and return the map of results
under the same bindings.
The ``'b`` type must be comparable (the ``COMPARE`` primitive must be
defined over it).
::
:: lambda 'elt 'b : set 'elt : 'S -> set 'b : 'S
- ``MAP body``: Apply the body expression to each element of the set.
The body sequence has access to the stack.
::
:: (set 'elt) : 'A -> (set 'b) : 'A
iff body :: [ 'elt : 'A -> 'b : 'A ]
- ``REDUCE``: Apply a function on a set passing the result of each
application to the next one and return the last.

View File

@ -318,18 +318,6 @@ let rec interp
(* sets *)
| Empty_set t, rest ->
logged_return (Item (empty_set t, rest), Gas.consume gas Gas.Cost_of.empty_set, ctxt)
| Set_map t, Item (lam, Item (set, rest)) ->
let gas = Gas.consume gas (Gas.Cost_of.set_to_list set) in
Gas.check gas >>=? fun () ->
let items =
List.rev (set_fold (fun e acc -> e :: acc) set []) in
fold_left_s
(fun (res, gas, ctxt, origination) arg ->
interp ?log origination gas orig source amount ctxt lam arg >>=?
fun (ret, gas, ctxt, origination) ->
return (set_update ret true res, gas, ctxt, origination))
(empty_set t, gas, ctxt, origination) items >>=? fun (res, gas, ctxt, origination) ->
logged_return ~origination (Item (res, rest), gas, ctxt)
| Set_reduce, Item (lam, Item (set, Item (init, rest))) ->
let gas = Gas.consume gas (Gas.Cost_of.set_to_list set) in
Gas.check gas >>=? fun () ->

View File

@ -117,7 +117,6 @@ let number_of_generated_growing_types : type b a. (b, a) instr -> int = function
| List_size -> 0
| List_iter _ -> 1
| Empty_set _ -> 1
| Set_map _ -> 1
| Set_reduce -> 0
| Set_iter _ -> 0
| Set_mem -> 0
@ -1337,12 +1336,6 @@ and parse_instr
rest ->
(Lwt.return (parse_comparable_ty t)) >>=? fun (Ex_comparable_ty t) ->
return (typed loc (Empty_set t, Item_t (Set_t t, rest, instr_annot)))
| Prim (loc, I_MAP, [], instr_annot),
Item_t (Lambda_t (param, ret), Item_t (Set_t elt, rest, _), _) ->
let elt = ty_of_comparable_ty elt in
(Lwt.return (comparable_ty_of_ty loc ret)) >>=? fun ret ->
check_item_ty elt param loc I_MAP 1 2 >>=? fun Eq ->
return (typed loc (Set_map ret, Item_t (Set_t ret, rest, instr_annot)))
| Prim (loc, I_REDUCE, [], instr_annot),
Item_t (Lambda_t (Pair_t ((pelt, _), (pr, _)), r),
Item_t (Set_t elt, Item_t (init, rest, _), _), _) ->

View File

@ -147,8 +147,6 @@ and ('bef, 'aft) instr =
(* sets *)
| Empty_set : 'a comparable_ty ->
('rest, 'a set * 'rest) instr
| Set_map : 'ret comparable_ty ->
(('param, 'ret) lambda * ('param set * 'rest), 'ret set * 'rest) instr
| Set_reduce :
(('param * 'res, 'res) lambda *
('param set * ('res * 'rest)), 'res * 'rest) instr