# Programming in Kotlin - Part 41: Challenge: Lambdas | Ray Wenderlich

**URL:** <https://forums.kodeco.com/t/programming-in-kotlin-part-41-challenge-lambdas-ray-wenderlich/40556>\
**Category:** 🎓 Courses & Articles\
**Created:** [March 21, 2018, 5:56am UTC](https://forums.kodeco.com/t/programming-in-kotlin-part-41-challenge-lambdas-ray-wenderlich/40556 "2018-03-21T05:56:13Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![kevindmoore](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/kevindmoore/32/109046_2.png) [@kevindmoore](https://forums.kodeco.com/u/kevindmoore)\
**Post date:** [March 21, 2018, 5:56am UTC](https://forums.kodeco.com/t/programming-in-kotlin-part-41-challenge-lambdas-ray-wenderlich/40556/1 "2018-03-21T05:56:13Z")

</div>

Practice using Lambdas through a hands-on challenge.

* * *
 This is a companion discussion topic for the original entry at [https://www.raywenderlich.com/4736-programming-in-kotlin/lessons/41](https://www.raywenderlich.com/4736-programming-in-kotlin/lessons/41)

---

<div class="post-metadata">

**Author:** ![fr3qfly](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/fr3qfly/32/81494_2.png) [@fr3qfly](https://forums.kodeco.com/u/fr3qfly)\
**Post date:** [January 22, 2019, 12:23pm UTC](https://forums.kodeco.com/t/programming-in-kotlin-part-41-challenge-lambdas-ray-wenderlich/40556/2 "2019-01-22T12:23:54Z")

</div>

Wrong Starter project. On the video at 0:23 shows what the Starter should look like, but the list and the class are missing.

---

<div class="post-metadata">

**Author:** ![fr3qfly](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/fr3qfly/32/81494_2.png) [@fr3qfly](https://forums.kodeco.com/u/fr3qfly)\
**Post date:** [January 22, 2019, 12:36pm UTC](https://forums.kodeco.com/t/programming-in-kotlin-part-41-challenge-lambdas-ray-wenderlich/40556/3 "2019-01-22T12:36:20Z")

</div>

Again no Audio during coding. Plus the last part didn’t even use lambda, however it could have been solved by a `.forEach{}`

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [January 22, 2019, 2:21pm UTC](https://forums.kodeco.com/t/programming-in-kotlin-part-41-challenge-lambdas-ray-wenderlich/40556/4 "2019-01-22T14:21:57Z")

</div>

@fr3qfly The instructor doesn’t talk while typing but explains the code afterwards.

---

<div class="post-metadata">

**Author:** ![fr3qfly](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/fr3qfly/32/81494_2.png) [@fr3qfly](https://forums.kodeco.com/u/fr3qfly)\
**Post date:** [January 22, 2019, 9:02pm UTC](https://forums.kodeco.com/t/programming-in-kotlin-part-41-challenge-lambdas-ray-wenderlich/40556/5 "2019-01-22T21:02:00Z")

</div>

@shogunkaramazov that’s not what I meant. For me the video goes silent once the coding screen comes up. And it stays silent till the end. If I go back before the coding screen came up the audio is back. I am using Safari. I tried it in Firefox and I think I know what can be the problem. In Firefox I can hear the commentary during the coding, however only on one ear (I am using earphones 🙂 ) It seams there is some mix-up of the Audio Channels in the video file.

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [January 22, 2019, 9:29pm UTC](https://forums.kodeco.com/t/programming-in-kotlin-part-41-challenge-lambdas-ray-wenderlich/40556/6 "2019-01-22T21:29:21Z")

</div>

@fr3qfly The video works in Safari without issues for me. Have you tried Chrome as well?

---

<div class="post-metadata">

**Author:** ![fr3qfly](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/fr3qfly/32/81494_2.png) [@fr3qfly](https://forums.kodeco.com/u/fr3qfly)\
**Post date:** [January 22, 2019, 10:31pm UTC](https://forums.kodeco.com/t/programming-in-kotlin-part-41-challenge-lambdas-ray-wenderlich/40556/7 "2019-01-22T22:31:18Z")

</div>

No, I don’t have Chrome, but I tried on a different computer. In Safari it works fine (still only the Left Audio channel has sound) I am not sure (it was yesterday late evening), but maybe only the right earphone was in my ears, and I didn’t check the left. 😅

---

<div class="post-metadata">

**Author:** ![getogrand](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/getogrand/32/81494_2.png) [@getogrand](https://forums.kodeco.com/u/getogrand)\
**Post date:** [January 30, 2019, 7:01am UTC](https://forums.kodeco.com/t/programming-in-kotlin-part-41-challenge-lambdas-ray-wenderlich/40556/8 "2019-01-30T07:01:57Z")

</div>

@kevindmoore  
Oh my god. Again the material issue on this course(this is a 3rd).  
Please compare uploaded material with the video. There is no given list, no given Person class, no given map.  
I really disappointed to this course.

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [January 30, 2019, 9:52am UTC](https://forums.kodeco.com/t/programming-in-kotlin-part-41-challenge-lambdas-ray-wenderlich/40556/9 "2019-01-30T09:52:13Z")

</div>

@kevindmoore Can you please help with this when you get a chance? Thank you - much appreciated! :]

---

<div class="post-metadata">

**Author:** ![kevindmoore](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/kevindmoore/32/109046_2.png) [@kevindmoore](https://forums.kodeco.com/u/kevindmoore)\
**Post date:** [January 31, 2019, 4:30am UTC](https://forums.kodeco.com/t/programming-in-kotlin-part-41-challenge-lambdas-ray-wenderlich/40556/10 "2019-01-31T04:30:42Z")

</div>

Exercise files should now be updated

---

<div class="post-metadata">

**Author:** ![henna\_dev](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/henna_dev/32/81494_2.png) [@henna\_dev](https://forums.kodeco.com/u/henna_dev)\
**Post date:** [April 30, 2019, 9:57am UTC](https://forums.kodeco.com/t/programming-in-kotlin-part-41-challenge-lambdas-ray-wenderlich/40556/12 "2019-04-30T09:57:07Z")

</div>

Hello, the solution used for summation of list does not work for me. It gives me an error on sum() saying unresolved reference . How do I fix this ?  
 ![image](https://files.chunter.kodeco.com/original/3X/f/7/f7088df6451b578affa616229b838138b938733b.png)  
Thanks

---

<div class="post-metadata">

**Author:** ![henna\_dev](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/henna_dev/32/81494_2.png) [@henna\_dev](https://forums.kodeco.com/u/henna_dev)\
**Post date:** [April 30, 2019, 11:43am UTC](https://forums.kodeco.com/t/programming-in-kotlin-part-41-challenge-lambdas-ray-wenderlich/40556/13 "2019-04-30T11:43:44Z")

</div>

I did fix this error by moving methods outside main, but I still dont understand why it happened in the first place.

---

<div class="post-metadata">

**Author:** ![kevindmoore](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/kevindmoore/32/109046_2.png) [@kevindmoore](https://forums.kodeco.com/u/kevindmoore)\
**Post date:** [April 30, 2019, 3:44pm UTC](https://forums.kodeco.com/t/programming-in-kotlin-part-41-challenge-lambdas-ray-wenderlich/40556/14 "2019-04-30T15:44:07Z")

</div>

I went and took another look at the project and don’t see a problem. It should work inside of the main function. Both filter and sum are part of the \_Collections.kt file (part of Kotlin standard library).  
Are you using the latest Intellij with the Kotlin plugin installed?

---

<div class="post-metadata">

**Author:** ![henna\_dev](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/henna_dev/32/81494_2.png) [@henna\_dev](https://forums.kodeco.com/u/henna_dev)\
**Post date:** [May 1, 2019, 2:55pm UTC](https://forums.kodeco.com/t/programming-in-kotlin-part-41-challenge-lambdas-ray-wenderlich/40556/15 "2019-05-01T14:55:52Z")

</div>

Thanks @kevindmoore. I am using intellij Ultimate 2019 edition and Kotlin 1.3.21.  
I knew this error should not have been there, so I tried working in a new file and it worked.

And in previous file I moved methods outside main and then it worked, but then I moved the methods again inside and then it dint show the error.  
Still no clue why the error was there.

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [July 8, 2019, 11:47pm UTC](https://forums.kodeco.com/t/programming-in-kotlin-part-41-challenge-lambdas-ray-wenderlich/40556/16 "2019-07-08T23:47:53Z")

</div>

@henna_dev Do you still have issues with this?

---

<div class="post-metadata">

**Author:** ![henna\_dev](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/henna_dev/32/81494_2.png) [@henna\_dev](https://forums.kodeco.com/u/henna_dev)\
**Post date:** [July 9, 2019, 11:41am UTC](https://forums.kodeco.com/t/programming-in-kotlin-part-41-challenge-lambdas-ray-wenderlich/40556/17 "2019-07-09T11:41:08Z")

</div>

Thanks @shogunkaramazov, it has been resolved. =)

---

<div class="post-metadata">

**Author:** ![iheart2code](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/iheart2code/32/84909_2.png) [@iheart2code](https://forums.kodeco.com/u/iheart2code)\
**Post date:** [September 4, 2019, 6:25pm UTC](https://forums.kodeco.com/t/programming-in-kotlin-part-41-challenge-lambdas-ray-wenderlich/40556/18 "2019-09-04T18:25:27Z")

</div>

I don’t understand what the 2nd and 3rd exercises in the example project have to do with what we just learned about lambdas. Destructuring and map iteration were covered earlier in the series and don’t use lambda functions in the solutions.

---

<div class="post-metadata">

**Author:** ![kevindmoore](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/kevindmoore/32/109046_2.png) [@kevindmoore](https://forums.kodeco.com/u/kevindmoore)\
**Post date:** [September 7, 2019, 3:42am UTC](https://forums.kodeco.com/t/programming-in-kotlin-part-41-challenge-lambdas-ray-wenderlich/40556/19 "2019-09-07T03:42:17Z")

</div>

You are right, the 2nd & 3rd example don’t fit the challenge. Here’s a different answer for the 3rd example:  
val names = mapOf\<String, Int\>(“John” to 34, “Fred” to 24, “Sam” to 30, “Suzzy” to 29)  
names.map { entry → println("${entry.key} is ${entry.value} years old ") }
