# K

For the proprietary array processing language developed by Arthur Whitney, see wikipedia:K (programming language).
This language is still a work in progress. A very work... in... very progress.

K is an abstract, lazy esoteric computer algebra programming language by User:Rdococ, designed to use non-traditional data types.

## Overview

Data type Description
`boolean` Used in boolean algebra.
`integer` A variable-size integer.
`rational` A fraction of two variable-size integers.
`real` An irrational, represented by a generalized continued fraction.
`function` A map from a set of one or more inputs to one output.
`set` A set, equivalent to a function from any input to a boolean output.
`list` A list, equivalent to a function from one integer to any output.
Construct Example Description
`→` `x → 2x` An anonymous function.
`{}` `{1, 4, 5}` A set.
`in` `3 in {1, 4, 5}` Returns if that element is in the set.
`{¦}` `{k ¦ k in Reals, k % 1 = 0}` Set-building notation for a lazy infinite set.
`[]` `[1, 1, 2]` A list or array.
`[→]` `[n → 2n]` A lazy infinite list.
`?:` `x>3 ? 1 : 0` Right-associative conditional.
`:=` `Integers := {k ¦ k in Reals, k % 1 = 0}` Declarative declaration.
`K` `K([n → n=1 ? 4 : (n-1)^2], [n → n=1 ? 0 : 2n-3])` A generalized continued fraction - an irrational. The first list are the partial numerators, and the second are the partial denominators.
`_` `[1, 3, 1]_2` List indexing.

### The K construct

K's namesake, the K construct, can take the definition to a generalized continued fraction, and return the real number corresponding to it. Of course, the real number itself is actually defined by the continued fraction, and that's how K stores it in memory. In order to determine if two generalized continued fractions are equivalent, K must apply algebra.

#### GCF Algebra

When comparing two GCFs, K applies the concept of the equivalence transformation. If K can successfully apply algebra to one of the GCFs to convert it into the other, then they are both equivalent. Otherwise, they are not.