What is Julia Ordering?

Viewed 179
sort(v; alg::Algorithm=defalg(v), lt=isless, by=identity, rev::Bool=false, order::Ordering=Forward)

order::Ordering=Forward confuses me, I can not find any document about it.

  • What is Ordering
  • What is Forward
1 Answers

These are defined in the module Base.Order:

help?> Base.Order.Ordering
      Base.Order.Ordering

  Abstract type which represents a total order on some set of elements.

  Use Base.Order.lt to compare two elements according to the ordering.

help?> Base.Order.Forward
  Base.Order.Forward

  Default ordering according to isless.

In order to find it out I just run:

@edit sort([1,2,3])

This is a very useful macro to find out what is going on.

Related