But now every function that reads from stdin needs to pass around an offset of where to read from which is very unergonomical. It also isn't really pure since offset is now state that is changing whenever a function is called.
fn do_stuff(offset: int) -> (string, int) {
x = read_guess(offset)
y = read_name("what's your name: ", offset + len(x))
z = read_guess(offset+len(x)+len(y))
new_offset = offset+len(x)+len(y)+len(z)
return ("name is: {y}, guess is: {x}", new_offset)
}
Ergonomics isn't really the point of a hypothetical extreme system. And no, you can compute offset as a result of all inputs to the system, like I did in my example - just keep passing a "previous state" value around, and compute the next state and return it. Like any other functional system already does 99% of the time.