iolist_size/1 in guard tests

Aleksander Nycz Aleksander.Nycz@REDACTED
Tue Jan 4 20:05:13 CET 2022


is_map_key/2 -> O(log(N))

so guard BIFs definition is:

complexity < O(N) and side effect free?


W dniu 04.01.2022 o 19:41, Mark Jones pisze:
> So guard BIFs are supposed to be O(1) not just side effect free?
>
> On Tue, Jan 4, 2022 at 12:36 PM Loïc Hoguin <essen@REDACTED> wrote:
>
>     Yes but that's considered a historical error.
>
>     On 04/01/2022 18:38, Mark Jones wrote:
>     > But length/1 is allowed in guard tests and it is O(N).
>     >
>     > Cheers,
>     > Mark
>     >
>     > On Tue, Jan 4, 2022 at 2:53 AM Aleksander Nycz
>     > <Aleksander.Nycz@REDACTED <mailto:Aleksander.Nycz@REDACTED>>
>     wrote:
>     >
>     >     Probably
>     >
>     >     iolist_size/1 -> O(N)
>     >
>     >     byte_size/1 -> O(1)
>     >
>     >
>     >     Regards
>     >     Aleksander
>     >
>     >
>     >     W dniu 04.01.2022 o 09:49, Mark Jones pisze:
>     >      > Is there a reason iolist_size/1 is not a guard BIF like
>     byte_size/1
>     >      > and bit_size/1?
>     >      >
>     >      > Cheers,
>     >      > Mark
>     >
>
>     -- 
>     Loïc Hoguin
>     https://ninenines.eu
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20220104/988de953/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5189 bytes
Desc: Kryptograficzna sygnatura S/MIME
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20220104/988de953/attachment.bin>


More information about the erlang-questions mailing list