[erlang-questions] Bounded length()

Wed Apr 10 11:35:55 CEST 2013

> A pro pos split_at_most():
> I've at times wished for a guard function 'lists:length_at_most(L,N)'
> Is this just me, or has anyone else run into such cases?

It's not just you, and for most uses of length/2 that I've seen
in guards, length_at_most/2 would be a better choice, giving
you O(N) testing instead of O(|L|) time.

So I'd say, we don't just want that function, we want it usable in guards.

More information about the erlang-questions mailing list