Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
5
Task/Factorial/Slope/factorial-1.slope
Normal file
5
Task/Factorial/Slope/factorial-1.slope
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
(define factorial (lambda (n)
|
||||
(cond
|
||||
((negative? n) (! "Negative inputs to factorial are invalid"))
|
||||
((zero? n) 1)
|
||||
(else (reduce (lambda (num acc) (* num acc)) 1 (range n 1))))))
|
||||
6
Task/Factorial/Slope/factorial-2.slope
Normal file
6
Task/Factorial/Slope/factorial-2.slope
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
(define factorial (lambda (n)
|
||||
(cond
|
||||
((negative? n) (! "Negative inputs to factorial are invalid"))
|
||||
((zero? n) 1)
|
||||
(else
|
||||
(for ((acc 1 (* acc i))(i 1 (+ i 1))) ((<= i n) acc))))))
|
||||
Loading…
Add table
Add a link
Reference in a new issue