Question: DESCRIPTION: For the final assignment, we will take a look at Erlang. Note that while Erlang is a functional language, in the same style as



DESCRIPTION: For the final assignment, we will take a look at Erlang. Note that while Erlang is a functional language, in the same style as Clojure, our focus here is the concurrency model provided by Erlang. In particular, this assignment will require you to gain some familiarity with the concept of message passing. In fact, this is all the assignment really does. In terms of code, the assignment is quite small, less then 100 lines of code. It's just about the details... So your task is to provide an extremely simple communication network for a group of friends. It is so simple that all the friends will actually do is send a contact message to one or more people in the group, and then wait for a confirmation reply from that person. That's it. You will, of course, need a list of a group of friends and the contact messages that will be sent by each person. This information will be read from a file called "calls.txt" that will be located in the same folder as the application code. While Erlang provides many file primitives for processing disk files, the process is not quite as simple as Clojure's slurpO function. So the "calls.txt" file will contain call records that already pre-formatted. In other words, they are ready to be read directly into Erlang data structures. An example of a "calls.txt" file is: john, [jill,joe, bob]). fjill, [bob, joe, bob]) sue, [jiil,jill,jiill, bob, jill]. bob, john]). joe, [sue]). Here, we have five calling tuples. The first field in each tuple contains the name of the person who will make the calls. The second field is a list of friends that this person will contact. So, for example the first tuple indicates that john will contact jill, joe, and bob To read this file, all you simply have to use the consult() function in the file module. This will load the contents into an Erlang list of 5 tuples (in this particular case). Note that NO error checking is required. The "calls.txt" file is guaranteed to exist and contain valid data. Each person will make at least one contact with another person, and all people in the contact list are guaranteed to exist and make at least one call. DESCRIPTION: For the final assignment, we will take a look at Erlang. Note that while Erlang is a functional language, in the same style as Clojure, our focus here is the concurrency model provided by Erlang. In particular, this assignment will require you to gain some familiarity with the concept of message passing. In fact, this is all the assignment really does. In terms of code, the assignment is quite small, less then 100 lines of code. It's just about the details... So your task is to provide an extremely simple communication network for a group of friends. It is so simple that all the friends will actually do is send a contact message to one or more people in the group, and then wait for a confirmation reply from that person. That's it. You will, of course, need a list of a group of friends and the contact messages that will be sent by each person. This information will be read from a file called "calls.txt" that will be located in the same folder as the application code. While Erlang provides many file primitives for processing disk files, the process is not quite as simple as Clojure's slurpO function. So the "calls.txt" file will contain call records that already pre-formatted. In other words, they are ready to be read directly into Erlang data structures. An example of a "calls.txt" file is: john, [jill,joe, bob]). fjill, [bob, joe, bob]) sue, [jiil,jill,jiill, bob, jill]. bob, john]). joe, [sue]). Here, we have five calling tuples. The first field in each tuple contains the name of the person who will make the calls. The second field is a list of friends that this person will contact. So, for example the first tuple indicates that john will contact jill, joe, and bob To read this file, all you simply have to use the consult() function in the file module. This will load the contents into an Erlang list of 5 tuples (in this particular case). Note that NO error checking is required. The "calls.txt" file is guaranteed to exist and contain valid data. Each person will make at least one contact with another person, and all people in the contact list are guaranteed to exist and make at least one call
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
