/**
 * You are given a list of musicians and an element. Implement a function that appends the element to the list
 * and returns the list sorted in ascending order. Additionally, the function should ensure that all elements
 * in the list are positive integers.
 *
 * @param musicianList A list of positive integers representing musicians.
 * @param element An integer representing the musician to be appended to the list.
 * @return The sorted musician list after appending the element and removing any negative or non-integer values.
 */
fun appendSortAbsolute(musicianList: MutableList<Int>, element: Int): List<Int> {

    // Append the element to the musician list
    musicianList.add(element)

    // Remove any negative or non-integer elements from the list
    musicianList.retainAll { it > 0 }

    // Sort the musician list in ascending order
    musicianList.sort()

    return musicianList
}

// Example usage
/**
 * You are given a list of musicians and an element. Implement a function that appends the element to the list
 * and returns the list sorted in ascending order. Additionally, the function should ensure that all elements
 * in the list are positive integers.
 *
 * @param musicianList A list of positive integers representing musicians.
 * @param element An integer representing the musician to be appended to the list.
 * @return The sorted musician list after appending the element and removing any negative or non-integer values.
 */
fun appendSortAbsolute(musicianList: MutableList<Int>, element: Int): List<Int> {
/**
 * You are given a list of musicians and an element. Implement a function that appends the element to the list
 * and returns the list sorted in ascending order. Additionally, the function should ensure that all elements
 * in the list are positive integers.
 *
 * @param musicianList A list of positive integers representing musicians.
 * @param element An integer representing the musician to be appended to the list.
 * @return The sorted musician list after appending the element and removing any negative or non-integer values.
 */
fun appendSortAbsolute(musicianList: MutableList<Int>, element: Int): List<Int> {

    // Append the element to the musician list
    musicianList.add(element)

    // Remove any negative or non-integer elements from the list
    musicianList.retainAll { it > 0 }

    // Sort the musician list in ascending order
    musicianList.sort()

    return musicianList
}

// Example usage