A Bigger Example
Explore how to rewrite an anagram program by leveraging Tasks and Agents in Elixir to load wordlists concurrently. Understand managing state with Agents and distributing work across nodes, enabling efficient parallel processing. This lesson guides you through running and interacting with distributed OTP servers to query anagrams from multiple wordlists.
We'll cover the following...
We'll cover the following...
Rewriting our anagram code
Let’s rewrite our anagram code to use both tasks and an agent.
We’ll load words in parallel from a number of separate dictionaries. A separate task handles each dictionary. We’ll use an agent to store the resulting list of words and signatures.
Our four wordlist files contain the following:
list1 |
list2 |
list3 |
list4 |
|---|---|---|---|
angor |
ester |
palet |
rogan |
argon |
estre |
patel |
ronga |
caret |