3 ms·
>> By introducing a single generic, you could reduce it from 500 lines to 20 No one is writing 500 lines of code - just as when you use the generics syntax you
by CraigJPerry 5y ago
>> By introducing a single generic, you could reduce it from 500 lines to 20
No one is writing 500 lines of code - just as when you use the generics syntax you don’t write the code that is generated by the compiler in response.
You could save about 10 lines, specifically these 10:
https://github.com/logic-building/functional-go/blob/master/internal/generatefp.go#L238 https://github.com/logic-building/functional-go/blob/master/...
You would still need the comparable ~40 lines of “generic” code:
https://github.com/logic-building/functional-go/blob/master/internal/template/basic/take.go https://github.com/logic-building/functional-go/blob/master/...