I/O Devices Communication In Elixir — Tentamen Software Testing Blog

Image for post
Image for post
Elixir IO List

TL;DR

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.

I/O

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

IO list is a deeply nested list, where each list element could be:

  • Binary
  • 0 to 255 Integer
  • IO List

In our example, we created an incremental list with the string “Does mask protect me against COVID-19 virus?” Then we use the IO.write function on that list.

Remember

  • 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.

Written by

Founder of Tentamen, software testing agency.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store