i did the function search that takes a los, a number, and returns the numth symbol of the list. simple
(define (search los num)
(cond
[(empty? los) empty]
[(zero? num) (first los)]
[else (lookup (rest los) (- num 1))]))
(check-expect (lookup (list 'a 'b 'c 'd) 0) 'a)
but i am having trouble figuring out how to design a function that takes a los (list of symbols) , a symbol (s) , and a number (numth) , and returns los with numth symbol replaced with s.
like something like this-
(change (list 'a 'b 'c 'd) 'hello 2) ;==> (list 'a 'b 'hello 'd)
(change (list 'a 'b 'c 'd) 'hi 0) ;==> (list 'hi 'b 'c 'd)
lookupand notsearch, perhaps?