: factorial ( Int -- Int )
    dup 1 i.<= [
        drop 1
    ] [
        dup 1 i.- factorial i.*
    ] if
;

: test-factorial ( -- )
    5 factorial
    120 test.assert-eq

    0 factorial
    1 test.assert-eq
;
