Is iteration on the F # map or is the bypass set in order?

AFAIK, F # The map and set are implemented as red-black trees, so I assume that iterating over them will be a workaround. I did some tests, and the iteration results are always sorted. But I want to make sure of this.

Is this workaround okay?

+4
source share
2 answers

The MSDN documentation is pretty good for figuring this out. For example, the return value for Set.toSeq is an "ordered sequence of set elements." It seems the answer to your question is yes, for both cards and sets.

+6
source

AFAIK, F # Map and set implemented as red-black trees

Trees AVL.

Is this workaround okay?

Yes.

+4
source

Source: https://habr.com/ru/post/1311914/


All Articles