Fsharp Range Rating

Is there a way to get the range in descending order?

Ex

[1..4]

estimated as

> val it : int list = [1; 2; 3; 4]

But

[4..1]

estimated as

> val it : int list = []

Is there any other syntax to achieve this without having to do List.Reverse?

+5
source share
1 answer

You need to do:

[4..-1..1]

-1 - step

+9
source

All Articles