/**
 * This function takes in two lists of integers as arguments and returns a new list
 * that contains the intersection of the two lists.
 *
 * @param economistList1 First list of integers
 * @param economistList2 Second list of integers
 * @return List containing the intersection of the two input lists
 * @throws IllegalArgumentException If the input arguments are not lists
 */
fun listIntersection(economistList1: List<Int>, economistList2: List<Int>): List<Int> {

    if (economistList1 !is List<*> || economistList2 !is List<*>) {
        throw IllegalArgumentException("Input arguments must be lists")
    }

    val intersection = mutableListOf<Int>()
    for (num in economistList1) {
        if (num in economistList2 && num !in intersection) {
            intersection.add(num)
        }
    }

    return intersection
}
/**
 * This function takes in two lists of integers as arguments and returns a new list
 * that contains the intersection of the two lists.
 *
 * @param economistList1 First list of integers
 * @param economistList2 Second list of integers
 * @return List containing the intersection of the two input lists
 * @throws IllegalArgumentException If the input arguments are not lists
 */
fun listIntersection(economistList1: List<Int>, economistList2: List<Int>): List<Int> {
/**
 * This function takes in two lists of integers as arguments and returns a new list
 * that contains the intersection of the two lists.
 *
 * @param economistList1 First list of integers
 * @param economistList2 Second list of integers
 * @return List containing the intersection of the two input lists
 * @throws IllegalArgumentException If the input arguments are not lists
 */
fun listIntersection(economistList1: List<Int>, economistList2: List<Int>): List<Int> {

    if (economistList1 !is List<*> || economistList2 !is List<*>) {
        throw IllegalArgumentException("Input arguments must be lists")
    }

    val intersection = mutableListOf<Int>()
    for (num in economistList1) {
        if (num in economistList2 && num !in intersection) {
            intersection.add(num)
        }
    }

    return intersection
}