mingchaoyan
mingchaoyan

Reputation: 8616

Erlang ordered_set store terms reversely

I just want to use ordered_set type of ets.

But the term I put is store in Erlang term sort, Like 1, 2, 3, 4...

How to store Erlang term in reversely order, like 4, 3, 2, 1

Upvotes: 1

Views: 157

Answers (1)

Alexey Romanov
Alexey Romanov

Reputation: 170859

It isn't possible. ordered_set works with standard Erlang term order and has no way to override it. But you can use ets:last and ets:prev to iterate from the last to the first stored term.

Upvotes: 2

Related Questions