How do I sort PureScript arrays in descending order?

Asked 2 years ago, Updated 2 years ago, 42 views

How do I sort the arrays in descending order in PureScript?

Currently, sort and then reverse like ↓.

module Main
  (main
  where

import Prelude

import Data.Array as Array
import Effect (Effect)
import Effect.Console as Console

main::Effect Unit
main=
  let xs = [3,1,2,5,4]
  in Console.logShow (Array.reverse (Array.sort xs))

Please let me know if there is a better way.

purescript

2022-09-29 21:40

1 Answers

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.