tablecloth
tablecloth copied to clipboard
Use labelled arguments for Set.add, Set.remove, and Map.remove
These functions use positional arguments for the value to be added or removed:
Set.add (Set.Int.fromList [1; 2]) 3 |> Set.toList = [1; 2; 3]
Set.remove (Set.Int.fromList [1; 2]) 2 |> Set.toList = [1]
Map.remove animalPopulations "Mosquito"
Use a ~key label for the keys and ~value label for the values, like what Map.add is doing, makes it easier to use pipelast:
Set.Int.fromList [1; 2] |> Set.add ~value:3 |> Set.toList = [1; 2; 3]
Set.Int.fromList [1; 2] |> Set.remove ~value:2 |> Set.toList = [1]
animalPopulations |> Map.remove ~key:"Mosquito"