Advertisement
matthammy

Untitled

Feb 26th, 2023
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. #lang racket
  2.  
  3.  
  4. ;(apply append (map (lambda (x) (clone x n)) lst))
  5.  
  6. (define (get-depth lst n)
  7. (cond
  8. ((null? lst) '())
  9. ((list? (car lst)) (cons (get-depth (car lst) (+ n 1)) (get-depth (cdr lst) n)))
  10. (else (cons n (get-depth (cdr lst) n)))
  11. )
  12. )
  13.  
  14.  
  15. (flatten (get-depth '((((a))) ((b)) (c)) 1))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement