'From list of pairs ((3 . #\J) (5 . #\Q)) to list of strings (("3J") (5Q)) in Scheme

I have a list of pairs ((3. #\K) (5 . #\J)) ... and I would like to create a function in scheme that returns the list as this: ("3K", "5J")... I've beeing trying but I cannot make it. This is what I have.

;  The deckCards will contain the list of pairs;
;  The real Deck will contain the empty list.
(define (deck->strings deckCards realDeck)
  (let lenOfItem ([n (my-lenght deckCards)])
    (if (= 1 n)
        (list (card->string (first deckCards)))
        (append realDeck (deck->strings (cdr deckCards) realDeck))))
  )

I did try doing with cond but for some reason it doesnt return the list and it seems impossible to append the list to the realDeack before calling itself recursively.



Solution 1:[1]

I think I found an approach and it worked. Not sure if it good to use it. However, this prints all the strings from top to boottom in a new line... Will this matter? I think its because I have 48 elements.

(map (lambda (i) (card->string i))
       clubs)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 brovia