Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

a) Generics would not make the function signatures shorter. You would have to introduce yet another concept: type inference for the signatures of anonymous functions.

b) No, it will not be less efficient. It's all done within one loop, in-place. You can compose everything inside the body of the loop. A functional language would do the same if it's intelligent.

c) You can easily create an infinite data source in Go with the generator pattern:

numbers := make(chan int); go func() { for i := 0; ; i++ { numbers <- i } }()

for n := range numbers {...}



> Generics would not make the function signatures shorter. You would have to introduce yet another concept: type inference for the signatures of anonymous functions

Yes, I should have said type inference obviously. I can't think of a decent functional language that doesn't have type inference though.

> No, it will not be less efficient. It's all done within one loop, in-place. You can compose everything inside the body of the loop. A functional language would do the same if it's intelligent.

If it's all done in one loop then it isn't composing. It's writing custom code every time you need to do something.

> You can easily create an infinite data source in Go with the generator pattern:

That's nice, you only need to change all of your code to do so. The functional version doesn't have that problem.


================

Please note that if your comment thread starts getting squished against the right side of the page like this, it might be time to move the conversation off of HN.

================




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: