Commit 525d85ce authored by Richer Maximilien's avatar Richer Maximilien Committed by Loïck Bonniot

[c] Add function to remove from item set

parent 498ce650
......@@ -105,3 +105,13 @@ func GetAllButOne(s []uint32, e uint32) []uint32 {
return res
}
// Remove an ID from the sequence
func Remove(s []uint32, e uint32) ([]uint32, error) {
for i, a := range s {
if a == e {
return append(s[:i], s[i+1:]...), nil
}
}
return s, errors.New("ID not in sequence")
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment