Tuple

October 31, 2020 ยท View on GitHub

A data structure that groups together a fixed number of items. Unlike an array, the tuple can usually contain items of more than one type. Often used to implement records.

Exercises

Kitchen Calculator

This exercise asks student to create and maintain few functions which use tuples as grouped information to represent different kitchen measurements

  • Tuples
  • Tuples as grouped information
  • Getting values from a tuple by use of element index
  • Getting values from a tuple using pattern matching
  • Creating new tuples

Implementations

TrackExerciseChanges
ElixirtuplesNone

Santa's Helper

This exercise asks the student to the student to implement a pair of functions which extract values from tuples, create tuples, and work with named tuple fields.

  • Tuples
  • Extract tuple components
  • Decompose tuples via pattern matching
  • Create and extract components of labeled and unlabeled tuples

Implementations

TrackExerciseChanges
SwifttuplesNone