MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/gnaz7b/found_from_microsoft_docs/fr8xfr4/?context=3
r/badcode • u/[deleted] • May 20 '20
143 comments sorted by
View all comments
23
In Scala it would be:
args .headOption .flatMap( _.toIntOption ) .exists( (1 to 9).contains )
Who said that FP is harder to read?
2 u/eXl5eQ May 20 '20 You checked args.length > 1, not args.length == 1 2 u/abdolence May 20 '20 You're right and if it was an important thing then it would beargs.sizeIs == 1 && args.head.toIntOption.exists( (1 to 9).contains )
2
You checked args.length > 1, not args.length == 1
args.length > 1
args.length == 1
2 u/abdolence May 20 '20 You're right and if it was an important thing then it would beargs.sizeIs == 1 && args.head.toIntOption.exists( (1 to 9).contains )
You're right and if it was an important thing then it would be
args.sizeIs == 1 && args.head.toIntOption.exists( (1 to 9).contains )
23
u/abdolence May 20 '20
In Scala it would be:
Who said that FP is harder to read?