K7 Tutorial

K7 Tutorial

The same notation can be used for input

If the reshape operator is given a list on the right that contains fewer items than is necessary to fill the shape, items from the front of the list will be reused

If k did not have the built-in eye function ( ), we could build a unit matrix by filling an n x n shape with a length n+1 unit vector:

While we have not intoroduced the operation, you have probably guessed that in the above example prepends to the following list. For binary expansion – just use 2 instead of 10

and we can use the same operator to split time in seconds into days, hours and minutes:

Several primitives exist in k to generate lists of lists in a single operation:

The four arithmetic operations , , and can operate on both scalars and arrays of arbitrary shape. For example,

In addition to the four arithmetic operations, k applies the same rules to

There are ways to reduce lists to single values.

Source: shakti.com