$parent-columns: $grid-columns !default;
$fg-column: $column;
$fg-gutter: $gutter;
$fg-max-columns: $grid-columns;
$container-display-table: false !default;
$layout-direction: LTR !default;

@function flex-grid($columns, $container-columns: $fg-max-columns) {
  $width: $columns * $fg-column + ($columns - 1) * $fg-gutter;
  $container-width: $container-columns * $fg-column + ($container-columns - 1) * $fg-gutter;
  @return percentage($width / $container-width);
}

@function flex-gutter($container-columns: $fg-max-columns, $gutter: $fg-gutter) {
  $container-width: $container-columns * $fg-column + ($container-columns - 1) * $fg-gutter;
  @return percentage($gutter / $container-width);
}

@function grid-width($n) {
  @return $n * $gw-column + ($n - 1) * $gw-gutter;
}

@function get-parent-columns($columns) {
  @if $columns != $grid-columns {
    $parent-columns: $columns !global;
  } @else {
    $parent-columns: $grid-columns !global;
  }

  @return $parent-columns;
}

@function is-display-table($container-is-display-table, $display) {
  @return $container-is-display-table == true or $display == table;
}

$parent-columns: $grid-columns !default;
$fg-column: $column;
$fg-gutter: $gutter;
$fg-max-columns: $grid-columns;
$container-display-table: false !default;
$layout-direction: LTR !default;

@function flex-grid($columns, $container-columns: $fg-max-columns) {
  $width: flex-width($columns);
  $container-width: flex-width($container-columns);
  @return percentage($width / $container-width);
}

@function flex-gutter($container-columns: $fg-max-columns, $gutter: $fg-gutter) {
  $container-width: flex-width($container-columns);
  @return percentage($gutter / $container-width);
}

@function flex-width($n, $column-width: $fg-column, $gutter-width: $fg-gutter) {
  @return $n * $column-width + ($n - 1) * $gutter-width;
}

@function get-parent-columns($columns) {
  @if $columns != $grid-columns {
    $parent-columns: $columns !global;
  } @else {
    $parent-columns: $grid-columns !global;
  }

  @return $parent-columns;
}

@function is-display-table($container-is-display-table, $display) {
  @return $container-is-display-table == true or $display == table;
}

Clarify how the grid calculation functions works
Clarify how the grid calculation functions works

The function `grid-width` was unused but defined. I renamed it to
`flex-width` to be consistent in naming with the other grid functions
and used it to calculate the width values that are used in `flex-grid` and
`flex-gutter` because the way these calculations work is always the
same.
