# conk manual

## stevan apter — 2000-06-23 14:40:57

    an interim version of manual.txt, along with the conk translator,

    std.conk, and joy.conk, can be found at www.kx.com/technical/contribs/stevan.

    conk.k (and the manual) are intended to provide the core language:  the

    k primitives and datatypes (except for lambdas) wrapped in a purely

    concatenative framework, plus the recursive combinators and stack operators

    of joy, for which there are no k equivalents.  std.conk, the standard conk

    library, defines common words, and joy.conk is the bridge between conk

    and joy:  everything which is primitive in joy, but not in either conk

    or std.conk, is defined, along with the standard library of joy, minus

    sets, which i have not implemented.

    although i have translated some k into an earlier version of conk, i

    haven't done any programming in the new version.

    i envision two audiences for conk:  k programmers, who are interested

    in concatenative languages (see below), and joy programmers who are

    interested in list-programming techniques.

    as a k programmer, conk allows me to explore two related issues:  first,

    how much does k's powerful applicative syntax contribute to productivity,

    and second, are the recursive combinators candidates for inclusion in the

    next implementation of k?

    let me expand on the second point.

    k programmers deplore explicit loops.  whenever possible, we want to

    cast loopy algorithms into combinations of adverbs, of which we have

    implemented just six:  over, scan, prior, each, each-left, and each-

    right.  the latter two may always be replaced by projection-with-each:

    a f each-left b -> f[a]each b, and a f each-right b -> f[;b]each a.

    it is a fact, no doubt an amazing one, that the remaining four adverbs,

    together with currying and atomic extension allow us to avoid explicit

    loops in nearly all circumstances, which means shorter code, a smaller

    executable, and c-or-better perforamnce.

    one area where adverb solutions are conspicuously unavailable is

    recursion.  atomic extension oftens substitutes (e.g. adding an

    atom to a depth n list), but just as often does not (i exclude

    dictionary recursion from consideration, since a conservative

    extension of atomic application to those datatypes is well known).

    so my question is:  what is the "right" set of recursive combinators

    which, when added to the set of k primitives, results in the

    smallest code for the most prominent types of recursion *in k*?

    i already have my suspicions that the answer regarding the joy

    combinators is:  none of the above.