Functional programming with generics?
We did an episode on functional programming in Go with Aaron Schlesinger back in 2019… But that was before generics were a thing. Let’s revisit the topic and discuss the pros and cons now that we have generics. What’s changed? What hasn’t?
Sign in or Join to comment or subscribe
Thank you so much for taking on this discussion. You both have the ability to discuss this subject far more eloquently than I can. I’m still learning a lot of concepts, but you’re helping me to concrete these in my mind, which I am very appreciative of.
I’d never heard of higher types in other languages, so thank you also for introducing me to this.
Just to say, I completed the Go survey prior to Generics being released. I said that I wasn’t bothered about them and would just write my code like ‘C’ anyway. Now they’ve come along and I’ve learnt about them, there’s no going back, they improve everything, not just FP. And over time my code has become way more idiomatic. Boring code rules!
I’d be interested to know what kind of functions other people have developed. I’m quite happy with my slice based standard deviation function and my slice based cumulative frequency slice generator. They’re not overly complex, but I feel that they’re quite interesting. I’m thinking of creating a function for lines of best fit for graphs also. Does anyone have any other interesting functions?