When To Use Elixir Lists — Tentamen Software Testing Blog

Image for post
Image for post

TL;DR

Syntax

Image for post
Image for post

Each item only knows about the next item. The List has a head (beginning) and tail (last item).

Elixir modules List and Enum are handy for List operations:

Image for post
Image for post
Image for post
Image for post

When To Use

++

This is a special operator that concatenates two lists. First List Tail becomes Second Tail Head.

Remember

  • Which Elixir Modules are useful for List manipulation
  • What is O(n) notation?
  • Add at the beginning
  • Traverse operation
  • ++ operator
  • Always test on the ListList of at least 1_000_000 elements

Originally published at https://blog.tentamen.eu on August 3, 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