One More Thin (Nim)…
Last updated
Was this helpful?
Last updated
Was this helpful?
Now that we have seen how Go and Python would do it, let's take a look at the implementation in . This one is special because Nim is arguably a language that is a blend of Python and Go - it has very Python-like syntax, does type inference and cross-platform compilation of executable binaries like Go (maybe less streamlined for now). And it supports both async/await as well as "spawn" (coroutines) syntaxes.
As a reminder, in this example we are:
Looking up a list of authors for the Microservices Architecture book, using Google Books API
Looking up, in parallel, the number of books each author has published. This means issuing several concurrent API calls to Google books API, all at the same time.
Waiting until all parallel lookups from #2 finish, since they can take different length of time, and when all of them are finished - printing out the results in a nicely-formatted way.
Side note: full source code of this example can be found at: