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 132407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T06:15:28+00:00 2026-05-11T06:15:28+00:00

I saw this code in Erlang: [X-$0 || X<-someFun()] In that line I found

  • 0

I saw this code in Erlang:

[X-$0 || X<-someFun()] 

In that line I found the -$0 syntax very useful.

I read the code and estimated what it means, but I’m not quite sure: is it split all numbers?

I’d like to see the explanation or man page of that syntax but I can’t find it. Can anyone show me the right page?

  • 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. 2026-05-11T06:15:28+00:00Added an answer on May 11, 2026 at 6:15 am

    What that code is doing is taking the output from someFun() (which needs to return a list), and for each element in the list it is assigning the element’s value to the variable X and then subtracting the ASCII value of the character 0 from that value. The resulting list is then the value of that whole expression.

    What it’s doing, in practice (and I’ve written this code dozens of times myself), is assuming that someFun/0 is a function that returns a string with just digits in it, and then converting that string into a list of the digits. So, if someFun() returned ‘12345‘, the result of this list comprehension is [1, 2, 3, 4, 5].

    If you’re familiar with the concept of a map function (as in, MapReduce), then this should be sounding pretty familiar by now.

    This wikibooks page looks like a good introduction to Erlang list comprehensions:

    http://en.wikibooks.org/wiki/Erlang_Programming/List_Comprehensions

    Joe Armstrong’s book ‘Programming Erlang’, from the Pragmatic Bookshelf, (http://pragprog.com/titles/jaerlang/programming-erlang) also covers list comprehensions really well (along with everything else Erlang related). Excellent book, highly recommended, etc.

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

Sidebar

Related Questions

I recently saw a bit of code that looked like this (with sock being
const static int foo = 42; I saw this in some code here on
I saw this same question for VIM and it has been something that I
The question came up when I saw this code: private static volatile ConcurrentHashMap<String, String>
In an answer on Stack Overflow, I saw this code: CREATE TABLE Favorites (
How can i change system culture that affects all pages(programmatically)? i saw this thread.
I am looking at some existing code in a web application. I saw this:
I've seen code that looks something like this: class MyClass: def __init__(self, someargs): myObj
I saw this in an answer to another question , in reference to shortcomings
I saw this quote on the question: What is a good functional language on

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.