Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (define (get-repeated-elem elem index)
- (if (= index 0) `()
- (cons elem (get-repeated-elem elem (- index 1)))
- )
- )
- (define (deep-repeat l)
- (define (helper l index)
- (cond ((null? l) `())
- ((list? (car l)) (helper (car l) (+ 1 index)))
- (append (get-repeated-elem (car l) index) (helper (cdr l) index))
- )
- )
- (helper l 0)
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement