I started to read "Scala puzzlers" yesterday evening. This is not as fun as "Java puzzlers", but it was so interesting that when I looked at the time it was 3 am!

There is aсtually a puzzle (Init you, init me):

object XY {
object X {val value: Int = Y.value + 1}
object Y {val value: Int = X.value + 1}
}

I have to figure out, why is it XY.X.value or XY.Y.value throws StackOverflowError, while the book says it should return 2.

In "Count me now, count me later" puzzle explanation it turned out that in order to understand Scala code, I have to know what the "eta expansion" is. This thing is from lambda calculus, which I knew nothing about, but ok, I've also read about alfa conversion and beta reduction too. Who knows what I'll need in the future.

Profile

boriskr

January 2017

S M T W T F S
1234567
891011121314
15161718192021
22 232425262728
293031    

Syndicate

RSS Atom

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 27th, 2017 12:27 am
Powered by Dreamwidth Studios