0

I basic have this code where I try to make a list of unique atoms from a list of lists of lists etc but my code doesn't seem to have any effect on the given lists, what could be wrong ? How to fix it?

(define (concatenar2 l1)
    (cond 
    [(null? l1) l1]
    [(list? (first l1)) (cons (concatenar2 (first l1)) (concatenar2 (rest l1)))]
    [else (cons (first l1) (concatenar2 (rest l1)))]
    )
)

(check-equal? (concatenar2 '()) '())
(check-equal? (concatenar2 '((a b c) (d e f g h))) '(a b c d e f g h)) ;; getting the input as a result from the function concatenar2

Also, I would like to avoid using the 'append' method from racket.

Lucas Lima
  • 51
  • 5
  • The linked answer uses `append`- if you can't use it, you have to write your own `append`: [How can I append two lists together? Scheme](https://stackoverflow.com/questions/56204166/how-can-i-append-two-lists-together-scheme) – Martin Půda Jun 06 '23 at 03:45
  • @MartinPůda oops, I missed that. Another dupe that shows a way that avoids `append`: https://stackoverflow.com/questions/13547965/racket-scheme-flatten-explanations – Shawn Jun 06 '23 at 12:26

0 Answers0