/* * Four things in this program . * first, a function using generics * second, a recursive function * third, tell the compiler to optimize for tail recursion * fourth, head and test functions on a list to create a * recursive function to step through a list * * @author ggtowell * Created: Aug 2, 2021 */ fun main() { var aa = listOf(1,2,3,4,5) bb(aa) bb(listOf("a", "s", "d", "f")) bb(listOf('a', 's', 'd', 'f')) } tailrec fun bb(b3: List) { if (b3.isEmpty()) return println(b3.first()) bb(b3.drop(1)) }