[erlang-questions] Proposal for is_iolist/1 guard

Robert Virding rvirding@REDACTED
Tue May 26 16:00:13 CEST 2009


I wouldn't "like" (:-)) to but if I was testing for an iolist that is what I
would have to do. Note that is_list/1 only tests the if argument is a cons
cell or a [], it does not do a deep test.

Robert

2009/5/26 Oscar Hellström <oscar@REDACTED>

> So if it's a list, you'd like to traverse the list and check if each
> value is either a binary, another iolist or an integer >= 0 and < 256?
>
> Robert Virding wrote:
> > Unfortunately not, as an iolist can also be a nested list strucure
> > containing bytes/characters and binaries.
> >
> > Robert
> >
> > 2009/5/26 Oscar Hellström <oscar@REDACTED
> > <mailto:oscar@REDACTED>>
> >
> >     Hi Maxim,
> >
> >     Wouldn't is_list(X); is_binary(X) be enough?
> >
> >     Maxim Treskin wrote:
> >     > Hello
> >     >
> >     > I see, erlang does not have is_iolist/1 guard, while iolist() type
> >     > used in some places in OTP (i.e. ports interaction).
> >     > Is it possible to add this BIF?
> >     >
> >     > Thank you.
> >     >
> >     > --
> >     > Maxim Treskin
> >     >
> >
> ------------------------------------------------------------------------
> >     >
> >     > _______________________________________________
> >     > erlang-questions mailing list
> >     > erlang-questions@REDACTED <mailto:erlang-questions@REDACTED>
> >     > http://www.erlang.org/mailman/listinfo/erlang-questions
> >     Best regards
> >
> >     --
> >     Oscar Hellström, oscar@REDACTED
> >     <mailto:oscar@REDACTED>
> >     Office: +44 20 7655 0337
> >     Mobile: +44 798 45 44 773
> >     Erlang Training and Consulting Ltd
> >     http://www.erlang-consulting.com/
> >
> >     _______________________________________________
> >     erlang-questions mailing list
> >     erlang-questions@REDACTED <mailto:erlang-questions@REDACTED>
> >     http://www.erlang.org/mailman/listinfo/erlang-questions
> >
> >
>
>
> --
> Oscar Hellström, oscar@REDACTED
> Office: +44 20 7655 0337
> Mobile: +44 798 45 44 773
> Erlang Training and Consulting Ltd
> http://www.erlang-consulting.com/
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090526/9d7d8121/attachment.htm>


More information about the erlang-questions mailing list