// Sass.
@use 'sass:list';
// Functions.
@use 'list.nth.function' as *;
// Modules.
@use '../number';
// Status: DONE
// The `list.from()` function returns the list of elements from index `$from` to the end of `$list`.
// @param `$list` The list from which the elements are picked.
// @param `$from` A number-type element index of `$list`.
// @return The return value is the list of elements from index `$from` to the last index of `$list`.
@function from($list, $from) {
$result: nth($list, number.range($from, list.length($list)) or $from...);
@return if(
$from <= list.length($list),
if(list.length($list) == $from, ($result,), $result),
null
);
}
// Examples.
// @debug from((('a', 'b', 'c'),), 1); // (('a', 'b', 'c'),)
// @debug from((('a', 'b', 'c'), 'a', 'b', c, d, 2, 4, 5, (a: 1)), 0); // ("a", "b", "c"), "a", "b", c, d, 2, 4, 5, (a: 1)
// @debug from((('a', 'b', 'c'), 'a', 'b', c, d, 2, 4, 5, (a: 1)), -1); // (a: 1), ("a", "b", "c"), "a", "b", c, d, 2, 4, 5, (a: 1)
// @debug from((('a', 'b', 'c'), 'a', 'b', c, d, 2, 4, 5, (a: 1)), 1); // ("a", "b", "c"), "a", "b", c, d, 2, 4, 5, (a: 1)
// @debug from(('a', 'b', c, d, 2, 4, 5, (a: 1)), 4); // d, 2, 4, 5, (a: 1)
// @debug from(('a', 'b', c, d, 2, 4, 5, (a: 1)), 7); // 5, (a: 1)
// negative index
// @debug from((('a', 'b', 'c'), ), -3); // null, null, ("a", "b", "c"), ("a", "b", "c")