In the previous post, we presented what Elixir offers in handling Dates and Time. Today we talk about I/O Lists, the data type for creating data streams for IO devices. This post is part of the functional language series, and it is based on the remarkable book Elixir In Action by Sasa Juric.
In computing, input/output, or I/O (or, informally, io or IO) is the communication between an information processing system, such as a computer, and the outside world, possibly a human or another information processing system. Inputs are the signals or data received by the system, and outputs are the signals or data sent from it. The term can also be used as part of an action; to “perform I/O” is to perform an input or output operation [source].
IO list is a deeply nested list, where each list element could be:
- 0 to 255 Integer
- IO List
In our example, we created an incremental
iodata list with the string “Does mask protect me against COVID-19 virus?” Then we use the IO.write function on that list.
- Use IO lists when you need to create an IO stream incrementally
- IO module has functions that work with IO lists
- Adding to IO List is O(1) while adding to the regular list is O(n).
Originally published at https://blog.tentamen.eu on October 15, 2020.