This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
cs330_f2016:erlang1 [2017/03/16 17:12] dhart [Deliverables:] |
cs330_f2016:erlang1 [2021/06/30 23:42] (current) |
||
|---|---|---|---|
| Line 7: | Line 7: | ||
| ====Preparation:==== | ====Preparation:==== | ||
| - | Install Elixir on your own machine. Use Erlang OTP version 19. | + | Install Elixir on your own machine. Use Erlang OTP version 19 (or more recent versions). |
| ---- | ---- | ||
| Line 51: | Line 51: | ||
| def map(function, vals) do ... | def map(function, vals) do ... | ||
| </code> | </code> | ||
| - | Map takes a function and a list vals and applies that function to each item in the list. Note that when using higher order functions in Elixir, you use ''&Module.functionName/arity'' to pass it, and ''functionName.(…)'' to call it. Thus,to test it, the call should look like this ''map(&Module.functionName/arity, list)''. | + | Map takes a function and a list vals and applies that function to each item in the list. Note that when using higher order functions in Elixir, you use ''&Module.functionName/arity'' to pass it, and ''functionName.(…)'' to call it. Thus,to test it, the call should look like this ''map(&Module.functionName/arity, list)''. For this lab, you can assume the arity of the function being passed in is 1. |
| === quickSortServer === | === quickSortServer === | ||
| Line 66: | Line 66: | ||
| def callServer(pid,nums) do | def callServer(pid,nums) do | ||
| send(pid, {nums, self()}) | send(pid, {nums, self()}) | ||
| - | listen | + | listen() |
| end | end | ||