Dining Philosophers in Erlang

前端 未结 1 1010
暖寄归人
暖寄归人 2021-01-28 21:58

If you have ever seen Dining Philosophers before, then you know that there are a few ways to do it. My implementation creates philosopher and fork processes which communicate wi

相关标签:
1条回答
  • 2021-01-28 22:29

    Right off the bat, I noticed two things:

    1. You have multiple unterminated receive blocks -- i.e., no end to match. See Erlang/OTP docs here.
    2. You likely have illegal guards. Instead of string:equal, you probably want to see if simple term comparison will work for you. See Erlang/OTP docs here.

    Finally, I know it's easy to copy & paste into a Stackoverflow question and not bother with formatting, but on the chance that your editor screen looks anything like that code above, you probably want to install the Erlang language support for your preferred editor. Indentation can be your friend. :-)

    0 讨论(0)
提交回复
热议问题