While sorting through random sheets of paper, I found my old CS homework. It was from a more innocent time of my freshman year. Where things seemed so new and I was so determined that I would succeed in these challenges.
Sniff, those easy days of programming…
All this just to switch the pronuns in a sentence!
(define (switch s)
(cond
((empty? s) \'())
((equal? (first s) \’you) (sentence \’i (switch-rest (butfirst s))))
…
(else (sentence (first s) (switch-rest (butfirst s))))))
(define (switch-rest s)
(cond
(empty? s) \'()
(equal? (first s) \’i) (sentence \’you (switch-rest (butfirst s))))
…
(else (sentence (first s) (switch-rest (butfirst s))))))
> (switch \'(you told me that I should wake you up))
(i told you you should wake me up)
Wow, that looks a lot like lisp
lissssssssp. i should take some time and learn some more of that interesting language.