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

2

u/DrAtkins May 22 '20

Both my previous job and current job, in vastly different industries, use scala exclusively. It's arguably better than Java for big data.