~jasper/type_stack_calc

157dc9d3bfbc1dd2cd936daed4d72ca4b72b9d8a — Jasper den Ouden 7 months ago 95e88bf intersection_nums
Makes factorial work.. sort of, its incorrectly marking them as not real.
As expected, produces way too many variants from a single little call.
Still surprised it works, a bit.
4 files changed, 10 insertions(+), 6 deletions(-)

A doc/ditched_code.md
M doc/files.md
M examples/factorial.tsc
M script/show.sh
A doc/ditched_code.md => doc/ditched_code.md +6 -0
@@ 0,0 1,6 @@

# Keep hashes of versions where code was ditched.

* `a3000af`: the old bit-based number type system.
* `a3000af`: single-number set.
  + `34a501d`: tests for the single-number sets.

M doc/files.md => doc/files.md +0 -2
@@ 138,8 138,6 @@ Does math about sets, for types to put together for type calculation.

* `empty.py`: `Empty` set.

* `one_num.py`: sets representing single numbers `OneFloat` and `OneInt`.

* `range.py`: `Range` of real numbers.

* `stepping.py`: `Stepping` is a set of `a*i + b` with `i` integer and currently `a` and `b` too. Used to represent integers, but bit more specific in the hopes it will find some optimizations. (and i can't help myself)

M examples/factorial.tsc => examples/factorial.tsc +2 -2
@@ 4,7 4,7 @@
      (n 1 >).if
}.fun factorial.set

5 i8.c factorial ;
5 0 10 Set.Range.c factorial ;

(n) {  # Loop-based factorial function.
    n f.set ;


@@ 15,4 15,4 @@
    f
}.fun fact_loop.set ;

6 i8.c fact_loop ;
6 0 10 Set.Range.fact_loop ;

M script/show.sh => script/show.sh +2 -2
@@ 4,7 4,7 @@ export PYTHONPATH="./::/usr/lib/python39.zip:/usr/lib/python3.9:/usr/lib/python3

# find test/ -type f | grep -G '.*[.]py' | \
ls test/{integermath,sc_parser}.py \
    test/sets/{cases,one_num,general,range,stepping,intersection}.py \
    test/sets/{cases,general,range,stepping,intersection}.py \
    | while read FILE; do
    if ! python $FILE ; then
        echo ❌ ERROR IN TEST $FILE


@@ 15,7 15,7 @@ done
# cat, parsed, stack, tc_code, e_code, c, variants, c_file

if [ "$1" == "" ]; then
    echo examples/gravity.tsc
    echo examples/factorial.tsc
elif [ "$1" == "all" ]; then
    find examples/ -type f | grep -G '.*$'
else