Can length function be used for function argument pattern matching

Something of this sort
where list will be the argument to the method , this can save some space as we will have to write less guards to bring in polymorphism.

method(length(list)==2) do
.......
end

method(length(list)==3) do
......
end