1 IN: compiler.tree.normalization.tests
2 USING: compiler.tree.builder compiler.tree.normalization
3 compiler.tree sequences accessors tools.test kernel math ;
5 \ count-introductions must-infer
6 \ fixup-enter-recursive must-infer
7 \ eliminate-introductions must-infer
10 [ 3 ] [ [ 3drop 1 2 3 ] build-tree count-introductions ] unit-test
12 [ 4 ] [ [ 3drop 1 2 3 3drop drop ] build-tree count-introductions ] unit-test
14 [ 3 ] [ [ [ drop ] [ 2drop 3 ] if ] build-tree count-introductions ] unit-test
16 [ 2 ] [ [ 3 [ drop ] [ 2drop 3 ] if ] build-tree count-introductions ] unit-test
18 : foo ( -- ) swap ; inline recursive
20 : recursive-inputs ( nodes -- n )
21 [ #recursive? ] find nip child>> first in-d>> length ;
26 [ normalize recursive-inputs ] bi
29 [ ] [ [ [ 1 ] [ 2 ] if + * ] build-tree normalize drop ] unit-test