concept tuple in category kotlin

appears as: tuple, tuples
The Joy of Kotlin

This is an excerpt from Manning's book The Joy of Kotlin.

But how did you find 14? By applying to the tuple of arguments the same process that you’ll be implementing for the function. It might fail because humans aren’t perfect. But most often it will succeed because this test consists of doing the same thing twice: once in your head and once with a computer program. This isn’t different from writing the implementation first, then running it with the given parameters, and then writing the test to verify it is the same output.

There can be a relationship between N x N and N; in which case, it’s a function. But it has only one argument that’s an element of N x N. N x N is the set of all possible pairs of integers. An element of this set is a pair of integers, and a pair is a special case of the more general tuple concept that’s used to represent combinations of several elements. A pair is a tuple of two elements.

sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest