Chen Yu
Chen Yu

Reputation: 4077

unknow erlang syntax

In the file of "jobs_info.erl" of github project "jobs", it contains the following codes:

pp(L) when is_list(L) ->
    [pp(X) || X <- L];
pp(X) ->
    case '#is_record-'(X) of %<=========What's meaning of '"#is_record-'?
    true ->
        RecName = element(1,X),
        {RecName, lists:zip(
            '#info-'(RecName,fields), %<=======what's meaning of ''#info-'?
            pp(tl(tuple_to_list(X))))};
    false ->
        if is_tuple(X) ->
            list_to_tuple(pp(tuple_to_list(X)));
           true ->
            X
        end
    end.

What's the expression of '#is_record-' and ''#info-'? "is_record" may be refered to erlang:is_record? But what's "'#info-'"?

Upvotes: 1

Views: 192

Answers (1)

mbesso
mbesso

Reputation: 715

As Kemal points out have a look at the method declaration at github.com/esl/parse_trans/blob/master/src/exprecs.erl#L116.

If it is the ' that confuses you, remember that a function name in Erlang is an atom and that an atom needs to start with a lower-case letter and if it does not it should be surrounded by '. Check the docs for more info.

Upvotes: 6

Related Questions