An experimental programming environment.
Switch branches/tags
Nothing to show
Clone or download

README.md

Denshi

A black lightning bolt on an orange background

Denshi is an experimental programming environment.

The Denshi Language

Denshi is a functional language, with no mutable state or effects. A Denshi computation is only capable of warming your computer, and then providing a value to a handler that performs effects on its behalf.

Denshi programs are made of concatenative combinators, a relatively obscure branch of combinatory logic that traces its lineage back to Forth and Joy.

As many people find Forth-like programs difficult to write, Denshi makes extensive use of program synthesis and projectional editing. Denshi programs are typically written by bots, or through mixed graphical/natural language interfaces that emphasize high level organization without attention to low level stack shuffling.

Philosophy

Programming today is in analogy with writing in the age of scribes. It's way too ceremonial, and only accessible to dedicated specialists. It needs to be made casual; something normal people engage in every day with ease.

There will still be professional programmers in such a future, just as there are professional writers today. It's just that programming will be a part of the human condition, rather than a tribal identity.

Logic

assocl*    (a (b c)) = ((a b) c)     assocr*
commute*       (a b) = (b a)        commute*
intro*             a = (a 1)           elim*
    
assocl+    {a {b c}} = {{a b} c}     assocr+
commute+       {a b} = {b a}        commute+
intro+             a = {a 0}           elim+

            <{a b} (c d)>
            ------------- medial
            (<a c> <b d>)

    b                    (<a b> a)
--------- abstraction    --------- application
<a (b a)>                    b


    a                      {a a}
--------- contraction    --------- cocontraction
  (a a)                      a

  (a b)                      a
--------- weakening-1    --------- coweakening-1
    a                      {a b}
   
  (a b)                      b
--------- weakening-2    --------- coweakening-2
    b                      {a b}

Content Addressing

A common pattern is to address a Denshi function by the hash of its source code, rather than a given name. This avoids many of the problems with namespaces, by using a single flat 256-bit namespace for all values: code, as well as "data" such as images, binaries and so on.

Blocks

A block is a chunk of code, essentially a first class function.

Modules

A module is a map from names to blocks.

Optimizers

A optimizer maps a block or a module to a better block or module. A common type of optimizer is a denoiser, which attempts to remove typical bugs from blocks.

Codecs

A codec is an encoder/decoder pair, that maps a block or a module to a vector (an array of real numbers).

A codec can be dense, in which case the vector is relatively small and contains precise information about the original contents of the block. Alternatively, a codec can be sparse, in which case the vector is relatively large and only contains general information about the classification of the original block.

Handlers

A handler gives a Denshi runtime the ability to perform effects.