Jump to content

Compile-time calculation: Difference between revisions

Line 499:
You can also calculate all factorials for 1 to 20 before defining fact method :
<lang Oforth>20 seq map(#[ seq reduce(#*) ]) Constant new: ALLFACTS
func: fact(n) { n ifZero: [ 1 ] else: [ ALLFACTS at(n) ] }</lang>
 
=={{header|OxygenBasic}}==
1,015

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.