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.<br><br>Robert<br>
<br><div class="gmail_quote">2009/5/26 Oscar Hellström <span dir="ltr"><<a href="mailto:oscar@erlang-consulting.com">oscar@erlang-consulting.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
So if it's a list, you'd like to traverse the list and check if each<br>
value is either a binary, another iolist or an integer >= 0 and < 256?<br>
<br>
Robert Virding wrote:<br>
> Unfortunately not, as an iolist can also be a nested list strucure<br>
> containing bytes/characters and binaries.<br>
><br>
> Robert<br>
><br>
> 2009/5/26 Oscar Hellström <<a href="mailto:oscar@erlang-consulting.com">oscar@erlang-consulting.com</a><br>
> <mailto:<a href="mailto:oscar@erlang-consulting.com">oscar@erlang-consulting.com</a>>><br>
><br>
> Hi Maxim,<br>
><br>
> Wouldn't is_list(X); is_binary(X) be enough?<br>
><br>
> Maxim Treskin wrote:<br>
> > Hello<br>
> ><br>
> > I see, erlang does not have is_iolist/1 guard, while iolist() type<br>
> > used in some places in OTP (i.e. ports interaction).<br>
> > Is it possible to add this BIF?<br>
> ><br>
> > Thank you.<br>
> ><br>
> > --<br>
> > Maxim Treskin<br>
> ><br>
> ------------------------------------------------------------------------<br>
> ><br>
> > _______________________________________________<br>
> > erlang-questions mailing list<br>
> > <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a> <mailto:<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a>><br>
> > <a href="http://www.erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br>
> Best regards<br>
><br>
> --<br>
> Oscar Hellström, <a href="mailto:oscar@erlang-consulting.com">oscar@erlang-consulting.com</a><br>
> <mailto:<a href="mailto:oscar@erlang-consulting.com">oscar@erlang-consulting.com</a>><br>
> Office: +44 20 7655 0337<br>
> Mobile: +44 798 45 44 773<br>
> Erlang Training and Consulting Ltd<br>
> <a href="http://www.erlang-consulting.com/" target="_blank">http://www.erlang-consulting.com/</a><br>
><br>
> _______________________________________________<br>
> erlang-questions mailing list<br>
> <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a> <mailto:<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a>><br>
> <a href="http://www.erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br>
><br>
><br>
<font color="#888888"><br>
<br>
--<br>
Oscar Hellström, <a href="mailto:oscar@erlang-consulting.com">oscar@erlang-consulting.com</a><br>
Office: +44 20 7655 0337<br>
Mobile: +44 798 45 44 773<br>
Erlang Training and Consulting Ltd<br>
<a href="http://www.erlang-consulting.com/" target="_blank">http://www.erlang-consulting.com/</a><br>
<br>
</font></blockquote></div><br>