CLOVIS
11/19/2020, 8:10 PMkioba
11/19/2020, 10:43 PMHow would you write it to be functional?The best way is to write the program the way you would normally do, make sure it works and step by step apply FP concepts that you know. One way is separating pure functions! In your example there are 4 high level steps that I can see:
Read output
-> parse
-> detect
-> User input UI
While read output
and the input UI
fundamentally impure actions you can’t do too much about them but parse and detect are a very good candidates to make them pure,CLOVIS
11/20/2020, 7:34 AMFlow
or something similar could help a lot, thanks.