@ Holykael:
Okay that not being French explains why I couldn't read it.
Anyway imma try to rewrite that in a more concise form and if I can figure it out I'll PM it to you.
I'm just gonna say: I hate group projects. Do they get better in a work environment or do people generally remain unbalanced in what they can contribute?
I'm just going to say
WELCOME TO HELL.--- edit ---
fffff
(define (anonimizer name-list input)
(string-join
(map (lambda (word)
(if (memf (lambda (arg)
(regexp-match? (pregexp (string-append* arg '("[:punct:]*[:alpha:]?"))) word)) name-list)
(regexp-replace* #px"[A-Za-z]" word "#")
word)) (string-split input))))
This mostly works although I don't know enough about regexen to not pick up the s in "Tony's."
Actually wait I'm overthinking this hang on.
--- edit ---
Whoops I'm stupid.
(define (anonimizer name-list input)
(string-join
(map (lambda (word)
(if (member word name-list)
(regexp-replace* #px"[A-Za-z]" word "#")
word)) (regexp-split #px"\\b" input)) ""))
1. regex-split breaks the input string into all of its substrings based on word boundaries, meaning that spaces and punctuation get moved into their own substrings. It then stuffs the tokens into a list.
2. map just calls the anonymous (lambda) function for every single element in the tokenized input string. If the token is in the name-list, I use a regex to replace all of the letters in that token with #s. If it's not in the censored name list, the if block just returns the original word.
Map's like specifically for applying the same operation to every item in a list and exists exactly to deal with what you were trying to do. I don't think recursion's really appropriate for that, although you could do it.
3. String join glues everything back together. By default, it sticks spaces in between each token. Since regexp-split already made the spaces their own tokens, I had to stick that "" at the end to tell it to not do that (use the substring "" instead of " " as glue, basically).
Six lines, and no recursion. It also uses the built in Racket string and regex libraries a lot because reinventing the wheel isn't considered a good idea.