Advertisement
cardel

Untitled

Mar 5th, 2022
3,226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Racket 0.29 KB | None | 0 0
  1. #lang eopl
  2.  
  3. (define lista-factoriales
  4.   (lambda (n)
  5.     (if
  6.      (= n 1)
  7.      (list (factorial n))
  8.      (append (lista-factoriales (- n 1)) (list (factorial n)))
  9.      )
  10.     )
  11.   )
  12.  
  13. (define factorial
  14.   (lambda (n)
  15.     (if
  16.      (= n 1)
  17.      1
  18.      (* n (factorial (- n 1)))
  19.      )))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement