'Data serialization format for Standard ML

I am looking for a way to write compound data (e.g. lists) to a file that can later be read back into the program. In Lisps, this is simply a matter of writing s-expressions to a file, and reading it back in later (using write and read for Scheme; prin1 and read for Common Lisp). Is there a similar method for doing this in Standard ML? Is there anything built-in that can help? (By "built-in", I mean something that is part of the language or basis library).



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source