Advertisement
cardel

Ejemplo 01 de Dic

Dec 1st, 2020
2,787
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Racket 0.50 KB | None | 0 0
  1. (define lista-factoriales
  2.   (lambda (n)
  3.     (letrec
  4.         (
  5.          (factorial (lambda (x)
  6.                       (if (= x 0) 1 (* x (factorial (- x 1))))
  7.                       )
  8.                     )
  9.  
  10.          (lista-factorial-aux
  11.           (lambda (n acc)
  12.             (if
  13.              (= n acc)
  14.              (list (factorial n))
  15.              (cons (factorial acc) (lista-factorial-aux n (+ acc 1)))
  16.              )
  17.             )
  18.           )
  19.          )
  20.        (lista-factorial-aux n 0)
  21.       )))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement