[erlang-questions] Guards syntax for multiple values
Fred Hebert
mononcqc@REDACTED
Mon Mar 25 20:35:39 CET 2019
On Mon, Mar 25, 2019 at 2:03 PM Jesper Louis Andersen <
jesper.louis.andersen@REDACTED> wrote:
>
> Thinking out loud, I think it might be beneficial to look at two additions:
>
> lists:member - because length(..) is in the set of Valid GuardSeqs and is
> O(n)
> maps:is_key
> maps:get
>
> The latter map variants are arguably even stronger since they have good
> lookup time, even for very large maps. Writing maps:is_key(X, #{ a => true,
> b => true }) should be fast and since it is a literal, it can be optimized
> in a number of ways by the compiler.
>
>
OTP-21 includes the new BIFs erlang:map_get(Key, Map) and
erlang:map_size(Map) for these reasons. Only lists:member is missing.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20190325/ee1156eb/attachment.htm>
More information about the erlang-questions
mailing list