2 ms·
Dude it is not because mathematical obsession or something we dislike Go. Consider checking whether an element `e` is in collection xs JS: xs.includes(e)
by higerordermap 6y ago
Dude it is not because mathematical obsession or something we dislike Go.
Consider checking whether an element `e` is in collection xs
JS:
xs.includes(e)
Python:
e in xs
Java:
xs.indexOf(e) != 1
C++:
std::find(xs.begin(), xs.end(), e) != xs.end()
It is already pretty verbose in C++.
Go:
contains := false
for _,x := range xs {
if x == e {
contains = true
break
}
}
Some fanboys claim Go is readable. Readability is not about conveying what each line does in micro level, it is about conveying __Intent__.
Go is nothing more than C as far as facilities to convey intent are concerned.