This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule State do | |
# At each stage of computation, State builds a function. That | |
# function accepts an "initial state" as an argument and returns | |
# a tuple containing a final computed value, and a final state | |
# The basis of State accepts a value and returns a function. | |
# The function returned accepts a state and returns a tuple with the | |
# value and the state. | |
def unit(value) do |