Skip to content

Commit 8490a87

Browse files
committed
README
0 parents  commit 8490a87

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

README

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
* REDUCT *
2+
3+
Test driven development is an increasingly popular method of developing programs. Developers using this methodology write programs in their language of choice and specify the intended behavior of their programs by writing a series of programmatic tests. These tests are typically structured as a set of inputs and their respective desired outputs.
4+
5+
REDUCT is the apotheosis of the test driven development methodology. It is test driven development reduced to its purest essence, the wine to a testing framework's grape juice.
6+
7+
Furthermore, REDUCT is a simple declarative programming language. In REDUCT you only specify what a program does, not how it does it.
8+
9+
Even an utter novices can write a REDUCT program, sometimes even correctly.
10+
11+
Sounds to good be true? Lets take a look.
12+
13+
** Syntax and Semantics **
14+
15+
Here is an example REDUCT program that may specify the factorial function.
16+
17+
```
18+
[0, 1, 3, 5, 20]
19+
[1, 1, 6, 120, 2432902008176640000]
20+
21+
```
22+
23+
A REDUCT program consists of two lines. Each line is a JSON array containing arbitrary JSON objects. The first line represents sample inputs. The second line represents corresponding outputs. The correct behavior on other inputs is inferred by the evaluator.
24+
25+
Thus the above program specifies a program that returns '1' for the input '0', '1' for the input '1', '3' for the input '6', '120', for the input '5' and '2432902008176640000' for the input '20'.
26+
27+
28+
** FALSIFIABILITY **
29+
30+
Those of you who are still reading might have a question. How on Earth do we know that's a factorial function? It's just some examples!
31+
32+
There are two different directions from which we can approach a proof.
33+
34+
*** Argument from observation:***
35+
36+
It so happens that the only way to verify the output of a REDUCT interpreter is to declare an additional input/output pair, which by definition the program will evaluate correctly. Thus, for all observable answers, this REDUCT program matches the factorial function. QED
37+
38+
*** Argument from definition: ***
39+
It passes the tests. The rest of the behavior is inferred correctly.
40+
41+
42+
Note that REDUCT provides exactly the same assurances as more traditional and widely used test driven design systems.
43+
44+
** REDUCT in REDUCT **
45+
46+
The following program specifies a REDUCT interpreter written in REDUCT, but only if you want it to.
47+
```
48+
[]
49+
[]
50+
```
51+
52+
Do you want it?
53+
54+
** REDUCT outside REDUCT **
55+
56+
A correct REDUCT interpreter that allows testing of inputs outside the test set is an open research problem. We think this is a fascinating opportunity to join the techniques of machine learning with the principles of programming language theory.
57+
58+
But uhhh, if you don't care about that requirement, you could use a hash table. Cheater.

0 commit comments

Comments
 (0)