Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5847133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:40:32+00:00 2026-05-22T12:40:32+00:00

When debugging a module (e.g. foo ) with list comprehensions temporary function names e.g.

  • 0

When debugging a module (e.g. foo) with list comprehensions temporary function names e.g.

foo:'-loop/4-lc$^2/1-3-'

can be found in trace output or error messages. If many list comprehensions are in a module its often hard to find out which one is running.

How can the function name be interpreted?

What are the meaning of the call parameters of these functions?

What is the meaning of the return value?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T12:40:33+00:00Added an answer on May 22, 2026 at 12:40 pm

    The fields can be described as follows:

    foo:'-loop/4-lc$^2/1-3-'
    ^     ^    ^ ^   ^ ^ ^
    1     2    3 4   5 6 7
    
    1. Module name
    2. The enclosing function
    3. Arity of the enclosing function
    4. The type of fun (lc = list generator in a list comprehension, blc = binary generator in a list comprehension, lbc = list generator in a binary comprehension, fun = fun)
    5. Index of function within defining function (0 based)
    6. Arity of the generated function
    7. Index of lambda lifted function within defining function

    Open questions: what is the meaning of the parameters and return values of these functions?

    Just stumbled on this answer by Robert Virding to the same question on the erlang-questions Mailinglist.


    The code which creates these names is spread among many modules: sys_pre_expand for funs; v3_core for functions created for comprehensions; and v3_kernel which adds more when lambda lifting the functions. The goal of all this is to create “unique” function names which also give some indication of why the functions were created and why.

    In sys_pre_expand.erl there is code fore creating function names for funs:

    %% new_fun_name(State) -> {FunName,State}.
    
    new_fun_name(#expand{func=F,arity=A,fcount=I}=St) ->
        Name = "-" ++ atom_to_list(F) ++ "/" ++ integer_to_list(A)
            ++ "-fun-" ++ integer_to_list(I) ++ "-",
        {list_to_atom(Name),St#expand{fcount=I+1}}.
    

    These names are passed on and expanded in a later pass (v3_kernel).

    From the compilers v3_core.erl:

    %% new_fun_name(Type, State) -> {FunName,State}.
    
    new_fun_name(Type, #core{fcount=C}=St) ->
        {list_to_atom(Type ++ "$^" ++ integer_to_list(C)),St#core{fcount=C+1}}.
    

    So this accounts for the “lc$^2” (parts 4 and 5) in the example. When looking at the places where it is used the possible values for part 4 can be deduced: lc, blc and lbc.

    In v3_kernel.erl is the next phase when these functions are lambda lifted:

    %% new_fun_name(Type, State) -> {FunName,State}.
    
    new_fun_name(Type, #kern{func={F,Arity},fcount=C}=St) ->
        Name = "-" ++ atom_to_list(F) ++ "/" ++ integer_to_list(Arity) ++
        "-" ++ Type ++ "-" ++ integer_to_list(C) ++ "-",
        {list_to_atom(Name),St#kern{fcount=C+1}}.
    

    This accounts for -loop/4- (parts 2 and 3) and -3- (part 7). Part 6 is added in the call to this new_fun_name/2.


    (This post is a community wiki, please add the other entries if you know what they mean)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm debugging from the python console and would like to reload a module every
Debugging some finance-related SQL code found a strange issue with numeric(24,8) mathematics precision. Running
Debugging a PHP program, is there any add-on/plug-in for browser which I can view
For debugging purposes in a somewhat closed system, I have to output text to
What is the recommended way to log application-specific messages in web2py? I found the
I was creating a http module and while debugging I noticed something which at
I am using the built-in module to insert a few instances, so they can
How can I drive the debugging session with some scripting language like ruby? Is
I am getting difficulty debugging my custom IIS module written in C++, using VS
I need to use python logging module to print debugging info to a file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.