fork download
  1. ; Reddit r/dailyprogrammer challenge #295
  2. ; Change the a sentence to another sentence, letter by letter.
  3. ; The sentences will always have the same length.
  4.  
  5. (letrec* (
  6. (sentence-from "a fall to the floor")
  7. (sentence-to "braking the door in")
  8. (sentence-len (string-length sentence-to))
  9. (change-sentence
  10. (lambda (index)
  11. (if (< index sentence-len)
  12. (begin
  13. (write-string sentence-from) (newline)
  14. (string-set! sentence-from index (string-ref sentence-to index))
  15. (change-sentence (+ index 1)))
  16. (begin
  17. (write-string sentence-from) (newline))))))
  18. (change-sentence 0))
  19.  
Success #stdin #stdout 0s 7280KB
stdin
Standard input is empty
stdout
a fall to the floor
b fall to the floor
brfall to the floor
braall to the floor
brakll to the floor
brakil to the floor
brakin to the floor
brakingto the floor
braking o the floor
braking t the floor
braking ththe floor
braking thehe floor
braking the e floor
braking the d floor
braking the dofloor
braking the dooloor
braking the dooroor
braking the door or
braking the door ir
braking the door in