March 2020
Intermediate to advanced
406 pages
8h 39m
English
Internal iterators are represented as higher-order functions (often utilizing anonymous functions, as we saw in Chapter 3, Understanding Concurrency). Higher-order functions take functions as arguments and return functions as outputs. Anonymous functions are functions that aren't bound to identifiers.
Internal iterators often map themselves to applying a function to every element in a container. This can be represented by a variable identifier or it can be represented anonymously. The authors of the language have mentioned that apply/reduce are possible in Go, but shouldn't be used (this is because for loops tend to be preferred in Go). This pattern follows along with Go's motto of simple is better than clever.
Read now
Unlock full access