Why do lists of numbers get printed incorrectly?
Sometimes the shell (or a program) prints a list of number in an unexpected way, for instance: 1> [65, 66, 67]. “ABC” This happens because Erlang represents strings as lists of integers, so if you ask the shell to print a list of integers, the shell takes a guess as to whether you want to see it as a list of numbers or as a string. The shell bases its guess on checking whether or not the list contains all printable characters, so you can force a string to be unprintable: 5> [0, 65, 66, 67]. [0,65,66,67] A similar problem occurs with io:fwrite(), but in that case you can take direct control by specifying the appropriate formatting character. “~s” always prints the argument as a string, “~w” always prints it as a list.