## Three simple programs in STML

All STML programs take their input from standard input and write to standard output (either of these can be redirected, of course). The input must be one integer value to a line. The output is produced as one integer value in decimal to a line.

Note: Doing the assignment does NOT require that you spend ANY time working through these STML programs to figure out how they work. Neither the original and the extended STM interpreter cares what the STML code actually does; they just interpret it. This STML code is only significant as providing test examples.

#### fraction.stm Digits of a fraction

The STM program "fraction.stm" computes the digits in a fraction. The input for the program is four numbers: N, the numerator; D, the denominator; B, the base; and K, the number of digits. The output is the first K digits of N/D in base B. For example the input
```1
7
10
10
```
produces the output
```1
4
2
8
5
7
1
4
2
8
```
since 1/7 = .1428571428... in base 10.

#### sort.stm: Insertion sort

The STM program "sort.stm" sorts a column of numbers using insertion sort. The input is given one number to a line, and terminated with the flag -1 The output echoes the number in sorted order. For example, the input
```31
4
15
92
65
35
-1
```
produces the output
```4
15
31
35
65
92
```

#### primes.stm: Primes

The STM program "primes.stm" generates a list of prime numbers The input is an integer N. The output is a list of all the prime numbers up to N. For example, the input
```12
```
produces the output
```2
3
5
7
11
```