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

"But maybe there's a whole class of problem (actual problem, not a sub-problem like "I want to implement a container") that I don't come in contact with."

i want to apply a transformation to every element in a collection

i want to select the elements from a collection for which some predicate holds true



Use a for loop. Stop thinking in LISP/Haskell/LINQ, start thinking in Go. Go is an imperative programming language. When in Rome do as the Romans do. Look at the code of the standard library to see how it's done.


It's not because it's unfamiliar that people are objecting; it's because it's suboptimal. Loops are harder to get right (try writing the loop to count down from 100 to 0 inclusive on unsigned ints), and they involve more boilerplate, obscuring the meaning of the code.

I don't think generics are an imperative/functional thing so much as an important feature of any statically typed system.


Those are both sub-problems.


of every software problem in history




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

Search: