Monday, February 20, 2023

Rust pop-quiz: descending function from an ordering-function

#Rust pop-quiz

Okay, 'sorted alphabetically' with a sort-function simply means the default-sort, which is to sort, ascending.

What if you don't want the default-sort?

Write a function, 

down(f: F) -> (f1: F)
   where F: FnMut(&T, &T) -> Ordering

Where f1 has this behavior: 



No comments:

Post a Comment