[erlang-questions] Questions on match specifications
Sat Nov 12 05:29:01 CET 2011
Erlang also has reserved words. If I were revising the manual, I would
modify section 2.3 to explicitly say "or if it is a reserved word"
with a link to the list of reserved words, which includes both 'and'
This has nothing to do with match specs specifically; as already
mentioned, there's a typo in that part of the manual. But in fact, you
cannot use 'and' or 'andalso' unquoted *anywhere* in Erlang if you
want them to be literal atoms rather than operators.
On Fri, Nov 11, 2011 at 9:21 PM, wrp <i3text@REDACTED> wrote:
> Thanks. That clear things up some. But I'm not sure about this one:
> On Nov 11, 6:44 am, Magnus Henoch <magnus.hen...@REDACTED>
>> > 1. Quoting seems incosistent. Why is 'and' quoted but andalso is not?
>> Probably a typo. Both need to be quoted, otherwise you get a syntax
> In the MatchConditions and MatchBody, aren't all the terms passed as
> Here are all the functions listed as allowed for ETS matches:
> abs is_atom is_record '=:=' 'and'
> element is_binary is_reference '=/=' 'or'
> hd is_constant is_seq_trace '==' 'not'
> length is_float is_tuple '/=' 'xor'
> node is_function '+' '<' 'band'
> round is_integer '-' '=<' 'bor'
> size is_list '*' '>' 'bnot'
> tl is_number 'div' '>=' 'bxor'
> trunc is_pid 'rem' andalso 'bsl'
> self is_port orelse 'bsr'
> According to the Erlang rules for atoms, "An atom should be enclosed
> in single quotes (') if it does not begin with a lower-case letter or
> if it contains other characters than alphanumeric characters,
> underscore (_), or @", so only the non-alphanumeric operators should
> need quoting. Why do the arithmetic and logical operators need to be
> erlang-questions mailing list
More information about the erlang-questions