/**
 * This exercise requires the archaeologist to excavate fragments from a list and join them with a delimiter.
 * The function takes two arguments: 'fragments', which is a list of strings containing the buried fragments,
 * and 'delimiter', which is a string used to join the fragments together.
 *
 * The task is to iterate through the 'fragments' list, find the fragments that are not empty or null,
 * concatenate them using the 'delimiter', and return the resulting joined string.
 *
 * To solve the exercise, you can use a combination of list comprehension, element access in a list, and string concatenation.
 */
fun excavateAndJoin(fragments: List<String?>, delimiter: String): String {

    val joinedString = fragments.filter { it != null && it.isNotEmpty() }
                                .joinToString(delimiter)

    return joinedString
}

// Example usage:
/**
 * This exercise requires the archaeologist to excavate fragments from a list and join them with a delimiter.
 * The function takes two arguments: 'fragments', which is a list of strings containing the buried fragments,
 * and 'delimiter', which is a string used to join the fragments together.
 *
 * The task is to iterate through the 'fragments' list, find the fragments that are not empty or null,
 * concatenate them using the 'delimiter', and return the resulting joined string.
 *
 * To solve the exercise, you can use a combination of list comprehension, element access in a list, and string concatenation.
 */
fun excavateAndJoin(fragments: List<String?>, delimiter: String): String {
/**
 * This exercise requires the archaeologist to excavate fragments from a list and join them with a delimiter.
 * The function takes two arguments: 'fragments', which is a list of strings containing the buried fragments,
 * and 'delimiter', which is a string used to join the fragments together.
 *
 * The task is to iterate through the 'fragments' list, find the fragments that are not empty or null,
 * concatenate them using the 'delimiter', and return the resulting joined string.
 *
 * To solve the exercise, you can use a combination of list comprehension, element access in a list, and string concatenation.
 */
fun excavateAndJoin(fragments: List<String?>, delimiter: String): String {

    val joinedString = fragments.filter { it != null && it.isNotEmpty() }
                                .joinToString(delimiter)

    return joinedString
}

// Example usage: