# It - what does it mean?

**URL:** <https://discuss.kotlinlang.org/t/it-what-does-it-mean/7450>\
**Category:** Uncategorized\
**Created:** [April 17, 2018, 3:00pm UTC](https://discuss.kotlinlang.org/t/it-what-does-it-mean/7450 "2018-04-17T15:00:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![calmosoft](https://avatars.discourse-cdn.com/v4/letter/c/ad7895/32.png) [@calmosoft](https://discuss.kotlinlang.org/u/calmosoft)\
**Post date:** [April 17, 2018, 3:00pm UTC](https://discuss.kotlinlang.org/t/it-what-does-it-mean/7450/1 "2018-04-17T15:00:30Z")

</div>

Hello,

What does the next line exactly mean:

**predictions.map { square(it - d) }.average()**

Code:

> fun square(d: Double) = d \* d
> 
> fun averageSquareDiff(d: Double, predictions: DoubleArray) =  
> **predictions.map { square(it - d) }.average()**
> 
> fun diversityTheorem(truth: Double, predictions: DoubleArray): String {  
> val average = predictions.average()  
> val f = “%6.3f”  
> return “average-error : ${f.format(averageSquareDiff(truth, predictions))}\n” +  
> “crowd-error : ${f.format(square(truth - average))}\n” +  
> “diversity : ${f.format(averageSquareDiff(average, predictions))}\n”  
> }
> 
> fun main(args: Array) {  
> println(diversityTheorem(49.0, doubleArrayOf(48.0, 47.0, 51.0)))  
> println(diversityTheorem(49.0, doubleArrayOf(48.0, 47.0, 51.0, 42.0)))  
> }

Greetings,  
Gal Zsolt  
(~ CalmoSoft ~)

---

<div class="post-metadata">

**Author:** ![jstuyts](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/jstuyts/32/2141_2.png) [@jstuyts](https://discuss.kotlinlang.org/u/jstuyts)\
**Post date:** [April 17, 2018, 3:07pm UTC](https://discuss.kotlinlang.org/t/it-what-does-it-mean/7450/2 "2018-04-17T15:07:23Z")

</div>

[https://kotlinlang.org/docs/reference/lambdas.html](https://kotlinlang.org/docs/reference/lambdas.html)

---

<div class="post-metadata">

**Author:** ![calmosoft](https://avatars.discourse-cdn.com/v4/letter/c/ad7895/32.png) [@calmosoft](https://discuss.kotlinlang.org/u/calmosoft)\
**Post date:** [April 17, 2018, 3:17pm UTC](https://discuss.kotlinlang.org/t/it-what-does-it-mean/7450/3 "2018-04-17T15:17:29Z")

</div>

Hello Johan,

Thanks for the help but I still do not know what **it** does mean.  
How can I translate it to C language?  
Please answer in details.

Greetings,  
Gal Zsolt  
(~ CalmoSoft ~)

---

<div class="post-metadata">

**Author:** ![jstuyts](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/jstuyts/32/2141_2.png) [@jstuyts](https://discuss.kotlinlang.org/u/jstuyts)\
**Post date:** [April 17, 2018, 3:30pm UTC](https://discuss.kotlinlang.org/t/it-what-does-it-mean/7450/4 "2018-04-17T15:30:04Z")

</div>

There is a specific section about `it` in the article I linked to. You have to understand lambdas to understand what it says, but lambdas are the subject of the article. I don’t know what I can add that would improve the information in the article.

---

<div class="post-metadata">

**Author:** ![ilya.gorbunov](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/ilya.gorbunov/32/1645_2.png) [@ilya.gorbunov](https://discuss.kotlinlang.org/u/ilya.gorbunov)\
**Post date:** [April 17, 2018, 3:31pm UTC](https://discuss.kotlinlang.org/t/it-what-does-it-mean/7450/5 "2018-04-17T15:31:35Z")

</div>

The more specific link: [https://kotlinlang.org/docs/reference/lambdas.html#it-implicit-name-of-a-single-parameter](https://kotlinlang.org/docs/reference/lambdas.html#it-implicit-name-of-a-single-parameter)

> It’s very common that a lambda expression has only one parameter.
> 
> If the compiler can figure the signature out itself, it is allowed not to declare the only parameter and omit `->`. The parameter will be implicitly declared under the name `it`:
> 
> `ints.filter { it > 0 } // this literal is of type '(it: Int) -> Boolean'`

---

<div class="post-metadata">

**Author:** ![calmosoft](https://avatars.discourse-cdn.com/v4/letter/c/ad7895/32.png) [@calmosoft](https://discuss.kotlinlang.org/u/calmosoft)\
**Post date:** [April 17, 2018, 3:36pm UTC](https://discuss.kotlinlang.org/t/it-what-does-it-mean/7450/6 "2018-04-17T15:36:49Z")

</div>

Hello Johan, Ilya,

Thanks for the help.  
Now I understand what **it** does mean.

Greetings,  
Gal Zsolt  
(~ CalmoSoft ~)
