Not exported by default but exportable.
uniq_adj(@list)=>LIST
Remove adjacent duplicates from list, i.e. behave more like Unix utility's uniq instead of
List::MoreUtils's "uniq" function, e.g.
my @res = uniq(1, 4, 4, 3, 1, 1, 2); # 1, 4, 3, 1, 2
uniq_adj_ci(@list)=>LIST
Like "uniq_adj" except case-insensitive.
uniq_ci(@list)=>LIST
Like "List::MoreUtils"' "uniq" except case-insensitive.
find_missing_nums_in_seq(LIST)=>LIST
Given a list of integers, return number(s) missing in the sequence, e.g.:
find_missing_nums_in_seq(1, 2, 3, 4, 7, 8); # (5, 6)
find_missing_strs_in_seq(LIST)=>LIST
Like "find_missing_nums_in_seq", but for strings/letters "a".."z".
find_missing_strs_in_seq("a", "e", "b"); # ("c", "d")
find_missing_strs_in_seq("aa".."zu", "zz"); # ("zv", "zw", "zx", "zy")
min_in_range($lower,$upper,@list)=>$num
Find lowest number $num in @list which still satisfies "$lower <= $num <= $upper". $lower and/or $upper
can be undef to express no limit.
minstr_in_range($lower,$upper,@list)=>$str
Find lowest string $str in @list which still satisfies "$lower le $x le $upper". $lower and/or $upper can
be undef to express no limit.
max_in_range($lower,$upper,@list)=>$num
Find highest number $num in @list which still satisfies "$lower <= $num <= $upper". $lower and/or $upper
can be undef to express no limit.
maxstr_in_range($lower,$upper,@list)=>$str
Find highest string $str in @list which still satisfies "$lower le $x le $upper". $lower and/or $upper
can be undef to express no limit.
pick(@list)=>$item
Randomly pick an item from list. It is actually simply done as:
$_[@_ * rand]
Example:
pick(1, 2, 3); # => 2
pick(1, 2, 3); # => 1
pick_n($n,@list)=>@picked
Randomly pick "n" different items from list. Note that there might still be duplicate values in the
result if the original list contains duplicates.
pick_n(3, 1,2,3,4,5); # => (3,2,5)
pick_n(2, 1,2,3,4,5); # => (3,1)
pick_n(2, 1,1,1,1); # => (1,1)
pick_n(4, 1,2,3); # => (3,1,2)