Your Turn

  • Exercise: Protocols-1

    A basic Caesar cypher consists of shifting the letters in a message by a fixed offset. For an offset of 1, for example, a will become b, b will become c, and z will become a. If the offset is 13, we have the ROT13 algorithm.

    Lists and binaries can both be stringlike. Write a Caesar protocol that applies to both. It would include two functions: encrypt(string, shift) and rot13(string).

  • Exercise: Protocols-2

    Using a list of words in your language, write a program to look for words where the result of calling rot13(word) is also a word in the list. (For various English word lists, look at http://wordlist.sourceforge.net/. The SCOWL collection looks promising, as it already has words divided by size.)

Get Programming Elixir now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.