🪄
- GitHub Staff
- https://hparker.xyz/
- @theHessParker
- @[email protected]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts ->() { # print out the result | |
script = ->(b) { # accessory funciton to beer improver to improve readability. | |
puts "#{b} bottles of beer on the wall. #{b} bottles of beer." | |
puts "you take one down, pass it around, #{b-1} bottles of beer on the wall." | |
} | |
beer_improver = ->(partial) { # a function that does any one bottle of beer on the wall. | |
->(n) { n.zero? ? "no more bottles" : ->(b) {script.(b); return partial.(b)}.(n-1)}} | |
y = ->(improver) { # Church's Y-Combinator. | |
->(gen) { gen.(gen) }.(->(gen) {beer_improver.(->(v) {gen.(gen).(v)})})} |
NewerOlder