/**
 * Given a list of positive integers and a threshold value, this function returns the intersection of two sets:
 * 1. Set containing numbers greater than or equal to the threshold.
 * 2. Set containing numbers that are not divisible by the threshold.
 *
 * The function performs short-circuiting evaluation to minimize unnecessary computations. It also handles cases where the threshold is zero or negative.
 *
 * @param numbers A list of positive integers.
 * @param threshold The threshold value.
 * @return Intersection of the two sets.
 */
fun intersectionShortCircuitingPositiveIntegers(numbers: List<Int>, threshold: Int): Set<Int> {

    if (threshold <= 0) {
        return emptySet()
    }

    val greaterEqualThreshold = numbers.filter { it >= threshold }.toSet()
    val notDivisibleThreshold = numbers.filter { it % threshold != 0 }.toSet()

    return greaterEqualThreshold.intersect(notDivisibleThreshold)
}
/**
 * Given a list of positive integers and a threshold value, this function returns the intersection of two sets:
 * 1. Set containing numbers greater than or equal to the threshold.
 * 2. Set containing numbers that are not divisible by the threshold.
 *
 * The function performs short-circuiting evaluation to minimize unnecessary computations. It also handles cases where the threshold is zero or negative.
 *
 * @param numbers A list of positive integers.
 * @param threshold The threshold value.
 * @return Intersection of the two sets.
 */
fun intersectionShortCircuitingPositiveIntegers(numbers: List<Int>, threshold: Int): Set<Int> {
/**
 * Given a list of positive integers and a threshold value, this function returns the intersection of two sets:
 * 1. Set containing numbers greater than or equal to the threshold.
 * 2. Set containing numbers that are not divisible by the threshold.
 *
 * The function performs short-circuiting evaluation to minimize unnecessary computations. It also handles cases where the threshold is zero or negative.
 *
 * @param numbers A list of positive integers.
 * @param threshold The threshold value.
 * @return Intersection of the two sets.
 */
fun intersectionShortCircuitingPositiveIntegers(numbers: List<Int>, threshold: Int): Set<Int> {

    if (threshold <= 0) {
        return emptySet()
    }

    val greaterEqualThreshold = numbers.filter { it >= threshold }.toSet()
    val notDivisibleThreshold = numbers.filter { it % threshold != 0 }.toSet()

    return greaterEqualThreshold.intersect(notDivisibleThreshold)
}