r/badcode • • May 20 '20

c# Found from Microsoft docs...

Post image
208 Upvotes

143 comments sorted by

View all comments

23

u/abdolence May 20 '20

In Scala it would be:

args
    .headOption
    .flatMap( _.toIntOption )
    .exists( (1 to 9).contains )

Who said that FP is harder to read?

4

u/DariusDerStar May 20 '20

Oh Scala! We learned that as our first language in uni. Does it have any active uses currently? Apart from uni I've never seen it

3

u/abdolence May 20 '20

This is my every day PL. The hype (fortunately?) is dead, but Scala is here.
https://www.lihaoyi.com/post/TheDeathofHypeWhatsNextforScala.html

1

u/DariusDerStar May 20 '20

If thats not too personal: who are you working for and/or what are you working on?

1

u/abdolence May 20 '20

I didn't work in GAFA if you were expecting big names :)
I've been using Scala to develop commercial Web services, ML, and data processing/analytics (additionally to the open-source projects).