An "is_string" BIF?

Mats Cronqvist <>
Thu Mar 10 17:20:50 CET 2005


   i personally would also like an is_string guard, primarily becasue it would 
make much code a lot easier to read.
   i agree with joe that one should be very careful in introducing new guards. 
but surely "string" is a much more important special case than e.g. "bananna".

   mats

Joe Armstrong (AL/EAB) wrote:
> I disagree - please not more special purpose guards when a general mechanism will do
> and why just is_octet? what about is_digit, is_alpha_numberic, is_ascii
> is_unicode is_bananna? 

Corrado Santoro wrote:
>>Dear all,
>>
>>I need an "is_string" function, something that behaves as follows:
>>
>>is_string ("ABC") -> true
>>is_string ([65,66,67]) -> true
>>is_string (['1','2',three]) -> false
>>...
>>
>>I know that I could do that by defining a suitable function, 
>>but I would 
>>like to use it in a guard. Is there a sort of BIF?
>>
>>Cheers,
>>--Corrado
>>
>>-- 
>>



More information about the erlang-questions mailing list