Skip to content

Instantly share code, notes, and snippets.

@vishesh
Created July 26, 2018 00:05
Show Gist options
  • Select an option

  • Save vishesh/8a3eaad120bd67b36278035f329b7d88 to your computer and use it in GitHub Desktop.

Select an option

Save vishesh/8a3eaad120bd67b36278035f329b7d88 to your computer and use it in GitHub Desktop.
Random stupid conversation
#lang racket
(define (conversation person-a person-b until)
(let loop ([until until]
[last-message-a ""]
[last-message-b ""]
[person-a person-a]
[person-b person-b])
(let ([next-message-a (string-append "I didnt know that " last-message-a)]
[next-message-b (string-append "you didnt know that " last-message-b)])
(displayln (string-append person-a ": " next-message-a "!"))
(when (positive? until)
(loop (sub1 until)
next-message-b
next-message-a
person-b
person-a)))))
(conversation "Vishesh" "Vinay" 5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment