// Get percentage from a given ratio.
_get-span(ratio = 1)
  return ratio * 100

// Work out the column widths based on the ratio and gutter sizes.
_get-column(ratios = 1, gutter = $jeet.gutter)
  ratios = _reverse(ratios) unless $jeet.parent-first is true
  width = 100

  for ratio in ratios
    gutter = gutter / width * 100
    width = 100 * ratio - gutter + ratio * gutter

  return width gutter

// Get the set layout direction for the project.
_get-layout-direction()
  $jeet.layout-direction == RTL ? result = right : result = left

  return result

// Replace a specified list value with a new value.
_replace-nth(list, index, value)
  result = ()
  index = length(list) + index if index < 0

  for i in (0..(length(list) - 1))
    if i == index
      append(result, value)
    else
      append(result, list[i])

  return result

// Reverse a list.
_reverse(list)
  result = ()

  for item in list
    prepend(result, item)

  return result
