3 ms·
I'm still a newb to F#, but did a few Advent of Code 2021 in it. Once I learned to do a log function that logged/dumped input to a file - and then returned the
by peheje 5y ago
I'm still a newb to F#, but did a few Advent of Code 2021 in it. Once I learned to do a log function that logged/dumped input to a file - and then returned the input - it was trivial to stick this log function anywhere in the pipes or folds or wherever to get a view of the program state.
I would then use the "Send to repl" feature to fire off single pieces of my program expressions to get instant feedback on the code I was writing. Long before the entire program was run in whole, each part had been run many times.
If you're in a classic whiteboard interview sessions you are robbed of this possibility. That's unfair because it's a big part of working with F# (I would guess other functional programs as well). You might feel you "pay" a bit in avoiding mutable state and having everything as an expression, but you gain so much in return, but you gotta use it!
I guess my argument is that a whiteboard situation might favor an imperative style, where you would write, compile, run and not use repl throughout development?