I want to add an integer to a list that already exists using Racket. Here is the code that I have so far.
(define (countBlackPegs gameList playerList)
(define blackPegs '())
(if (equal? (car playerList) (car gameList))
(set! blackPegs '(1))
;;otherwise
(set! blackPegs '(0)))
)
In theory I should be able to repeat the if statement (examining a different part of the list each time) and then append the blackPegs list with the appropriate value based on the result of the if statement. Unfortunately every append function I have tried doesn't work correctly. Any help would be appreciated.