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
| def aclosure(outer) | |
| -> (inner) {inner + outer} | |
| end | |
| add3 = aclosure(3) | |
| add10 = aclosure(10) | |
| puts add3.call(5) | |
| puts add10.call(5) |
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
| #!/bin/ruby | |
| require 'json' | |
| require 'stringio' | |
| def count_swaps(sort_me) | |
| is_sorted = false | |
| swap_count = 0 | |
| while is_sorted == false |
OlderNewer