import math


def slide_split(num: int, num_val: int, num_test: int) -> list:
    """ A slide dataset split scheme. The slide reference is the test set, so that the test set among all reslut splits cover the whole dataset (execept for the first a few samples) 

    Args:
        num (int): Total number of samples in the dataset
        num_val (int): Number of samples for validation dataset
        num_test (int): Number of samples for test dataset

    Returns:
        list: The list of dataset split folds. Each fold (an entry in the list) is a 3-tuple whose elements are train_index, val_index, test_index in order
    """
    assert num_val + num_test < num, "Sum of num_val and num_test should be less than num."
    index_all = list(range(num))
    index_splits = list()
    num_folds = math.floor((num - num_val) / num_test)

    for fold_idx in range(num_folds):
        #  ... left ... val_index ... center ... test_index ... right
        left = num - (fold_idx + 1) * num_test - num_val
        center = num - (fold_idx + 1) * num_test
        right = num - fold_idx * num_test
        val_index = index_all[left:center]
        test_index = index_all[center:right]
        train_index = list(set(index_all) - set(val_index) - set(test_index))
        index_splits.append((train_index, val_index, test_index))
        print(index_splits[-1])
    return index_splits