iter icon indicating copy to clipboard operation
iter copied to clipboard

Sequence.(--^) inconsistent with CCList.(--^)

Open copy opened this issue 8 years ago • 1 comments

Sequence.(--^) returns a reversed range, while CCList.(--^) returns a range with the right bound excluded.

See:

CCList.(--^) 0 5;;
(* val _1 : int list = [0; 1; 2; 3; 4] *)
Sequence.(--^) 5 0 |> Sequence.to_list;;
(* val _2 : int list = [5; 4; 3; 2; 1; 0] *)
Sequence.(--^) 0 5 |> Sequence.to_list;;
(* val _3 : int list = [] *)

I would suggest deprecating Sequence.(--^), since the CCList behaviour is more useful and the operator looks half-open range (the hat being on the right. I would expect a reversed range to include an arrow of some sorts).

copy avatar Nov 01 '17 20:11 copy

Fair point, but retrocompatibility seems to indicate it won't be possible to have a consistent state any time soon…

c-cube avatar Nov 04 '17 22:11 c-cube