fork download
  1. ; finding god
  2.  
  3. (define (drop n xs)
  4. (let loop ((n n) (xs xs))
  5. (if (or (zero? n) (null? xs)) xs
  6. (loop (- n 1) (cdr xs)))))
  7.  
  8. (define bible '(
  9. In the beginning God created the heaven and the earth
  10.  
  11. And the earth was without form and void and darkness
  12. was upon the face of the deep
  13. And the Spirit of God moved upon the face of the waters
  14.  
  15. And God said Let there be light and there was light))
  16.  
  17. (define alice '(
  18. Alice was beginning to get very tired of sitting
  19. by her sister on the bank and of having nothing
  20. to do once or twice she had peeped into the book
  21. her sister was reading))
  22.  
  23. (define twinkle '(
  24. Twinkle twinkle little star
  25. How I wonder what you are
  26. Up above the world so high
  27. Like a diamond in the sky
  28. Twinkle twinkle little star
  29. How I wonder what you are))
  30.  
  31. (define huck-finn '(
  32. You dont know about me without you have read a book
  33. by the name of The Adventures of Tom Sawyer but that
  34. aint no matter That book was made by Mr Mark Twain
  35. and he told the truth mainly There was things which
  36. he stretched but mainly he told the truth That is
  37. nothing I never seen anybody but lied one time or
  38. another without it was Aunt Polly or the widow or
  39. maybe Mary Aunt Polly Toms Aunt Polly she is and
  40. Mary and the Widow Douglas is all told about in
  41. that book which is mostly a true book with some
  42. stretchers as I said before))
  43.  
  44. (define trees '(
  45. I think that I shall never see
  46. A poem lovely as a tree
  47.  
  48. A tree whose hungry mouth is prest
  49. Against the earths sweet flowing breast
  50.  
  51. A tree that looks at God all day
  52. And lifts her leafy arms to pray
  53.  
  54. A tree that may in Summer wear
  55. A nest of robins in her hair
  56.  
  57. Upon whose bosom snow has lain
  58. Who intimately lives with rain
  59.  
  60. Poems are made by fools like me
  61. But only God can make a tree))
  62.  
  63. (define psalm23 '(
  64. The Lord is my shepherd I shall not want
  65.  
  66. He maketh me to lie down in green pastures
  67. he leadeth me beside the still waters
  68.  
  69. He restoreth my soul he leadeth me in the
  70. paths of righteousness for his names sake
  71.  
  72. Yea though I walk through the valley of
  73. the shadow of death I will fear no evil
  74. for thou art with me thy rod and thy
  75. staff they comfort me.
  76.  
  77. Thou preparest a table before me in the
  78. presence of mine enemies thou anointest
  79. my head with oil my cup runneth over
  80.  
  81. Surely goodness and mercy shall follow
  82. me all the days of my life and I will
  83. dwell in the house of the Lord for ever))
  84.  
  85. (define scheme '(
  86. Programming languages should be designed not by
  87. piling feature on top of feature but by removing
  88. the weaknesses and restrictions that make additional
  89. features appear necessary Scheme demonstrates that a
  90. very small number of rules for forming expressions
  91. with no restrictions on how they are composed
  92. suffice to form a practical and efficient programming
  93. language that is flexible enough to support most of
  94. the major programming paradigms in use today))
  95.  
  96. (define (chain words)
  97. (let loop ((words words) (chain (list (car words))))
  98. (let* ((count (string-length (symbol->string (car words))))
  99. (text (drop count words)))
  100. (if (null? text) (reverse chain)
  101. (loop text (cons (car text) chain))))))
  102.  
  103. (define (chains words)
  104. (let loop ((words words) (chains (list)))
  105. (if (null? words) (reverse chains)
  106. (loop (cdr words) (cons (chain words) chains)))))
  107.  
  108. (define (count chains)
  109. (let ((prev (car (reverse (car chains)))))
  110. (let loop ((chains chains) (count 0))
  111. (cond ((null? chains) count)
  112. ((not (equal? (car (reverse (car chains))) prev))
  113. count)
  114. (else (loop (cdr chains) (+ count 1)))))))
  115.  
  116. (define (obey? words)
  117. (< 1/3 (/ (count (chains words)) (length words))))
  118.  
  119. (display (chains alice)) (newline)
  120.  
  121. (display (obey? bible)) (newline)
  122. (display (obey? alice)) (newline)
  123. (display (obey? twinkle)) (newline)
  124. (display (obey? huck-finn)) (newline)
  125. (display (obey? trees)) (newline)
  126. (display (obey? psalm23)) (newline)
  127. (display (obey? scheme)) (newline)
Success #stdin #stdout 0.91s 9264KB
stdin
Standard input is empty
stdout
((Alice very by sister having twice the sister) (was get of by sister having twice the sister) (beginning sister having twice the sister) (to very by sister having twice the sister) (get of by sister having twice the sister) (very by sister having twice the sister) (tired sister having twice the sister) (of by sister having twice the sister) (sitting and nothing had the sister) (by sister having twice the sister) (her the of nothing had the sister) (sister having twice the sister) (on bank nothing had the sister) (the of nothing had the sister) (bank nothing had the sister) (and nothing had the sister) (of nothing had the sister) (having twice the sister) (nothing had the sister) (to once had the sister) (do or she into sister) (once had the sister) (or she into sister) (twice the sister) (she into sister) (had the sister) (peeped was) (into sister) (the sister) (book reading) (her reading) (sister) (was) (reading))
#t
#t
#t
#t
#t
#t
#f