Skip to content

p4ymak/range_rover

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Function to pack integers into ranges.

Latest version

Takes a custom sequence of integers and produces a sorted vector of ranges.

Example:

use range_rover::range_rover;

let input = vec![-1, -2, 2, 0, 7, 10, -4, 1, 3, 6, 10, -3, 4, 9, 8];
let result = range_rover(input);
assert_eq!(result, vec![-4..=4, 6..=10]);

Takes a custom sequence of integers and range, produces a sorted vector of excluded ranges in range.

Example:

use range_rover::missed_in_range;
let input = vec![-1, -2, 2, 0, 7, 10, -4, 1, 3, 6, -3, 10, 4, 9, 8, -2];
let missed = missed_in_range(input, -10..=20);
assert_eq!(missed, vec![-10..=-5, 5..=5, 11..=20]);

About

Rust function to pack integers into ranges.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages