Why no is_string()?
Raimo Niskanen
raimo.niskanen@REDACTED
Wed Aug 27 16:39:28 CEST 2003
It would require a test for each element in the whole list. The only
guard function I know of that is O(N) is length(), and that is almost a
mistake since guard tests must be fast.
/ Raimo Niskanen, Erlang/OTP, Ericsson AB
Vance Shipley wrote:
> There is no guard test is_string(). Now I realize that strings
> are not a unique data type in Erlang however they are respresented
> as such in many ways. In the external term format there is a
> unique tag for strings. In the documentation we have things with
> type "string()".
>
> I'd like to have a is_string() guard which would tell the difference
> between [foo, <<1,2,3>>, [a,b,c]] and "bar".
>
> Would this require a time consuming test of each element of the list
> or is the internal tagging already there?
>
> -Vance
>
>
>
More information about the erlang-questions
mailing list