So I was practicing racket beginner language when I came along this question.
Write a function str-replace
which consumes a string, a target character, and a
replacement character. The function produces a new string, which is identical to the consumed string with all occurrences of the target character (if any) replaced with the replacement character. For example, (string-replace "word" #\o #\y) ⇒ "wyrd"
.
Note:
I may not use any built-in string functions other than string->list
and list->string
.
So I started with the code now I got stuck, how do I use wrapper function for this code as far now I have only this
;; los is list of string
(define(str-replace los)
(+(first los)
(first (rest los))
(first (rest (rest los)))
(first (rest (rest (rest los))))))