[f:[$0>][@@\f;!\1-]#%]r: { reduce n stack items using the given basis and binary function }
1 2 3 4 0 4[+]r;!." " { 10 }
1 2 3 4 1 4[*]r;!." " { 24 }
1 2 3 4 0 4[$*+]r;!. { 30 }