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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:02:02+00:00 2026-05-15T13:02:02+00:00

Long story short I am trying to replicate the Sleeping barber problem in Erlang.

  • 0

Long story short I am trying to replicate the Sleeping barber problem in Erlang.

In my solution I decided that for all the processes that are waiting I would put them into a list. Then, once it was that processes turn, I would take that PID off of the list.

Unfortunately when I call

length(myListOfPids).

it fails, as an example:

length([<0.46.0>]).
* 2: syntax error before: '<'

is there a way to store PID’s so that I can recall them and use them normally? i.e.

PID ! message

… just in case it matters here is the actual error I recieve when running my program:

=ERROR REPORT==== 1-Jul-2010::05:50:40 ===
Error in process <0.44.0> with exit value:
{badarg,[{erlang,length,[<0.46.0>]},{barber1,waitingRoom,2}]}

barber1 is my module, waitingRoom is the function that keeps track of which processes are waiting

  • 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-15T13:02:02+00:00Added an answer on May 15, 2026 at 1:02 pm

    Entering Pids by typing them does not work for me either.
    Is that the only problem?

    With code:

    -module(test).
    -export([loop/0]).
    
    loop() ->
        receive
            {hello} ->
                io:format("Hello world!~n"),
                loop()
    end.
    

    I get:

     Eshell V5.7.5  (abort with ^G)
     1> Pid = spawn(fun test:loop/0).
     <0.35.0>
     2> L = [Pid].
     [<0.35.0>]
     3> length(L). 
     1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Long story short: I'm trying to write an app that'll dump IE's history to
I'm trying to make a WCF service that will work with JSON-P (long-story short,
Long story short, I have an ASP.NET application I'm trying to debug and at
So long story short, im trying to build a chat application....well its already built
Long story short, I have a substantial Python application that, among other things, does
Long story short, we found files promoting prescription drugs on our server that we
Long story short, I'm developing a theme template for a blog that enables you
Long story short, the database I'm using needs to get looked at. Until that
Long story short, I'm making a custom Swing component that's basically a JTable with
Long story short, I'm trying to add a few extra items to ViewData to

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.