- Коректно
- 4 успешни тест(а)
- 0 неуспешни тест(а)
.... Finished in 0.00262 seconds 4 examples, 0 failures
Срокът за предаване на решения е отминал
Функция от по-висок ред е функция, която изпълнява едно от следните: * Приема една или повече функции като аргументи * Връща функция като резултат
В това предизвикателство искаме от вас да дефинирате две функции: complement
и compose
.
complement
Дефинирайте функция complement(f)
, която приема функция и връща друга функция,
която приема същите аргументи като f
, има същия ефект като f
, но връща:
true
, когато f
се оценява на false
false
, когато f
се оценява на true
is_answer = ->(n) { n == 42 }
not_answer = complement(is_answer)
is_answer.call(42) # => true
is_answer.call(12) # => false
not_answer.call(42) # => false
not_answer.call(12) # => true
compose
Дефинирайте функция compose(f, g)
, която приема две функции и връща тяхната
композиция (f ∘ g). Нотацията с кръгчето може да бъде прочетена така: "f след g",
"f от g" и други.
Върнатата от compose
функция трябва да приема броят аргументи, който приема и
функцията, подадена като втори аргумент на compose
(в горния пример това е g
).
add_two = ->(n) { n + 2 }
is_answer = ->(n) { n == 42 }
compose(is_answer, add_two).call(40) # => true
compose(is_answer, add_two).call(10) # => false
Написали сме примерни тестове, които може да намерите в хранилището с домашните. Как да си ги пуснете може да видите в ръководството. Когато проверяваме предадените решения, ще включим и допълнителни тестове.
Преди да предадете решение се уверете, че тестовете ви се изпълняват без грешки. Това ще ви гарантира, че не сте сбъркали нещо тривиално. Например име на функция, брой приемани аргументи и подобни.
Забележка: Няма да ви бъдат подавани грешни данни. Няма нужда да правите допълнителни проверки за некоректни аргументи или да връщате специални стойности в случай на грешка.
.... Finished in 0.00262 seconds 4 examples, 0 failures
.F.F Failures: 1) complement complements a function with arity of two Failure/Error: is_sum_four = ->(a, b) { a + b == 4 } ArgumentError: wrong number of arguments (1 for 2) # /tmp/d20151019-15631-1xxie48/spec.rb:11:in `block (3 levels) in <top (required)>' # /tmp/d20151019-15631-1xxie48/solution.rb:2:in `call' # /tmp/d20151019-15631-1xxie48/solution.rb:2:in `block in complement' # /tmp/d20151019-15631-1xxie48/spec.rb:14:in `call' # /tmp/d20151019-15631-1xxie48/spec.rb:14:in `block (2 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>' 2) compose returns a function composition with arity of two of two functions Failure/Error: pow = ->(a, b) { a**b } ArgumentError: wrong number of arguments (1 for 2) # /tmp/d20151019-15631-1xxie48/spec.rb:29:in `block (3 levels) in <top (required)>' # /tmp/d20151019-15631-1xxie48/solution.rb:6:in `call' # /tmp/d20151019-15631-1xxie48/solution.rb:6:in `block in compose' # /tmp/d20151019-15631-1xxie48/spec.rb:31:in `call' # /tmp/d20151019-15631-1xxie48/spec.rb:31:in `block (2 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>' Finished in 0.00288 seconds 4 examples, 2 failures Failed examples: rspec /tmp/d20151019-15631-1xxie48/spec.rb:10 # complement complements a function with arity of two rspec /tmp/d20151019-15631-1xxie48/spec.rb:27 # compose returns a function composition with arity of two of two functions
.... Finished in 0.00297 seconds 4 examples, 0 failures
.... Finished in 0.00258 seconds 4 examples, 0 failures
.... Finished in 0.0026 seconds 4 examples, 0 failures
.F.F Failures: 1) complement complements a function with arity of two Failure/Error: expect(sum_not_four.call(2, 2)).to eq false ArgumentError: wrong number of arguments (2 for 1) # /tmp/d20151019-15631-177qo2k/solution.rb:2:in `block in complement' # /tmp/d20151019-15631-177qo2k/spec.rb:14:in `call' # /tmp/d20151019-15631-177qo2k/spec.rb:14:in `block (2 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>' 2) compose returns a function composition with arity of two of two functions Failure/Error: expect(compose(add_two, pow).call(2, 3)).to eq 10 ArgumentError: wrong number of arguments (2 for 1) # /tmp/d20151019-15631-177qo2k/solution.rb:6:in `block in compose' # /tmp/d20151019-15631-177qo2k/spec.rb:31:in `call' # /tmp/d20151019-15631-177qo2k/spec.rb:31:in `block (2 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>' Finished in 0.00285 seconds 4 examples, 2 failures Failed examples: rspec /tmp/d20151019-15631-177qo2k/spec.rb:10 # complement complements a function with arity of two rspec /tmp/d20151019-15631-177qo2k/spec.rb:27 # compose returns a function composition with arity of two of two functions
.... Finished in 0.00262 seconds 4 examples, 0 failures
.... Finished in 0.00263 seconds 4 examples, 0 failures
.F.F Failures: 1) complement complements a function with arity of two Failure/Error: expect(sum_not_four.call(2, 2)).to eq false ArgumentError: wrong number of arguments (2 for 1) # /tmp/d20151019-15631-1rlj5xz/solution.rb:2:in `block in complement' # /tmp/d20151019-15631-1rlj5xz/spec.rb:14:in `call' # /tmp/d20151019-15631-1rlj5xz/spec.rb:14:in `block (2 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>' 2) compose returns a function composition with arity of two of two functions Failure/Error: expect(compose(add_two, pow).call(2, 3)).to eq 10 ArgumentError: wrong number of arguments (2 for 1) # /tmp/d20151019-15631-1rlj5xz/solution.rb:8:in `block in compose' # /tmp/d20151019-15631-1rlj5xz/spec.rb:31:in `call' # /tmp/d20151019-15631-1rlj5xz/spec.rb:31:in `block (2 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>' Finished in 0.0028 seconds 4 examples, 2 failures Failed examples: rspec /tmp/d20151019-15631-1rlj5xz/spec.rb:10 # complement complements a function with arity of two rspec /tmp/d20151019-15631-1rlj5xz/spec.rb:27 # compose returns a function composition with arity of two of two functions
.... Finished in 0.01412 seconds 4 examples, 0 failures
.F.F Failures: 1) complement complements a function with arity of two Failure/Error: expect(sum_not_four.call(2, 2)).to eq false ArgumentError: wrong number of arguments (2 for 1) # /tmp/d20151019-15631-18eflfw/solution.rb:2:in `block in complement' # /tmp/d20151019-15631-18eflfw/spec.rb:14:in `call' # /tmp/d20151019-15631-18eflfw/spec.rb:14:in `block (2 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>' 2) compose returns a function composition with arity of two of two functions Failure/Error: expect(compose(add_two, pow).call(2, 3)).to eq 10 ArgumentError: wrong number of arguments (2 for 1) # /tmp/d20151019-15631-18eflfw/solution.rb:6:in `block in compose' # /tmp/d20151019-15631-18eflfw/spec.rb:31:in `call' # /tmp/d20151019-15631-18eflfw/spec.rb:31:in `block (2 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>' Finished in 0.00277 seconds 4 examples, 2 failures Failed examples: rspec /tmp/d20151019-15631-18eflfw/spec.rb:10 # complement complements a function with arity of two rspec /tmp/d20151019-15631-18eflfw/spec.rb:27 # compose returns a function composition with arity of two of two functions
.... Finished in 0.00258 seconds 4 examples, 0 failures
FF.. Failures: 1) complement complements a function Failure/Error: expect(not_answer.call(12)).to eq true expected: true got: false (compared using ==) # /tmp/d20151019-15631-a4ojzj/spec.rb:7:in `block (2 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>' 2) complement complements a function with arity of two Failure/Error: expect(sum_not_four.call(1, 2)).to eq true expected: true got: false (compared using ==) # /tmp/d20151019-15631-a4ojzj/spec.rb:15:in `block (2 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>' Finished in 0.00286 seconds 4 examples, 2 failures Failed examples: rspec /tmp/d20151019-15631-a4ojzj/spec.rb:2 # complement complements a function rspec /tmp/d20151019-15631-a4ojzj/spec.rb:10 # complement complements a function with arity of two
.... Finished in 0.00269 seconds 4 examples, 0 failures
.F.F Failures: 1) complement complements a function with arity of two Failure/Error: expect(sum_not_four.call(2, 2)).to eq false ArgumentError: wrong number of arguments (2 for 1) # /tmp/d20151019-15631-1dgtml2/solution.rb:2:in `block in complement' # /tmp/d20151019-15631-1dgtml2/spec.rb:14:in `call' # /tmp/d20151019-15631-1dgtml2/spec.rb:14:in `block (2 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>' 2) compose returns a function composition with arity of two of two functions Failure/Error: expect(compose(add_two, pow).call(2, 3)).to eq 10 ArgumentError: wrong number of arguments (2 for 1) # /tmp/d20151019-15631-1dgtml2/solution.rb:6:in `block in compose' # /tmp/d20151019-15631-1dgtml2/spec.rb:31:in `call' # /tmp/d20151019-15631-1dgtml2/spec.rb:31:in `block (2 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>' Finished in 0.00277 seconds 4 examples, 2 failures Failed examples: rspec /tmp/d20151019-15631-1dgtml2/spec.rb:10 # complement complements a function with arity of two rspec /tmp/d20151019-15631-1dgtml2/spec.rb:27 # compose returns a function composition with arity of two of two functions
.... Finished in 0.00259 seconds 4 examples, 0 failures
.F.F Failures: 1) complement complements a function with arity of two Failure/Error: expect(sum_not_four.call(2, 2)).to eq false ArgumentError: wrong number of arguments (2 for 1) # /tmp/d20151019-15631-1hc9y2m/solution.rb:6:in `block in complement' # /tmp/d20151019-15631-1hc9y2m/spec.rb:14:in `call' # /tmp/d20151019-15631-1hc9y2m/spec.rb:14:in `block (2 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>' 2) compose returns a function composition with arity of two of two functions Failure/Error: expect(compose(add_two, pow).call(2, 3)).to eq 10 ArgumentError: wrong number of arguments (2 for 1) # /tmp/d20151019-15631-1hc9y2m/solution.rb:2:in `block in compose' # /tmp/d20151019-15631-1hc9y2m/spec.rb:31:in `call' # /tmp/d20151019-15631-1hc9y2m/spec.rb:31:in `block (2 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>' Finished in 0.0028 seconds 4 examples, 2 failures Failed examples: rspec /tmp/d20151019-15631-1hc9y2m/spec.rb:10 # complement complements a function with arity of two rspec /tmp/d20151019-15631-1hc9y2m/spec.rb:27 # compose returns a function composition with arity of two of two functions
.... Finished in 0.00519 seconds 4 examples, 0 failures
.... Finished in 0.00295 seconds 4 examples, 0 failures
.... Finished in 0.00265 seconds 4 examples, 0 failures
.... Finished in 0.00258 seconds 4 examples, 0 failures
.F.F Failures: 1) complement complements a function with arity of two Failure/Error: expect(sum_not_four.call(2, 2)).to eq false ArgumentError: wrong number of arguments (2 for 1) # /tmp/d20151019-15631-1lp9eyu/solution.rb:2:in `block in complement' # /tmp/d20151019-15631-1lp9eyu/spec.rb:14:in `call' # /tmp/d20151019-15631-1lp9eyu/spec.rb:14:in `block (2 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>' 2) compose returns a function composition with arity of two of two functions Failure/Error: expect(compose(add_two, pow).call(2, 3)).to eq 10 ArgumentError: wrong number of arguments (2 for 1) # /tmp/d20151019-15631-1lp9eyu/solution.rb:8:in `block in compose' # /tmp/d20151019-15631-1lp9eyu/spec.rb:31:in `call' # /tmp/d20151019-15631-1lp9eyu/spec.rb:31:in `block (2 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>' Finished in 0.0028 seconds 4 examples, 2 failures Failed examples: rspec /tmp/d20151019-15631-1lp9eyu/spec.rb:10 # complement complements a function with arity of two rspec /tmp/d20151019-15631-1lp9eyu/spec.rb:27 # compose returns a function composition with arity of two of two functions
.... Finished in 0.00266 seconds 4 examples, 0 failures
FF.F Failures: 1) complement complements a function Failure/Error: not_answer = complement(is_answer) NoMethodError: undefined method `complement' for #<RSpec::Core::ExampleGroup::Nested_1:0x007fa2f5fb0258> # /tmp/d20151019-15631-k5upjh/spec.rb:4:in `block (2 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>' 2) complement complements a function with arity of two Failure/Error: sum_not_four = complement(is_sum_four) NoMethodError: undefined method `complement' for #<RSpec::Core::ExampleGroup::Nested_1:0x007fa2f5fa1d48> # /tmp/d20151019-15631-k5upjh/spec.rb:12:in `block (2 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>' 3) compose returns a function composition with arity of two of two functions Failure/Error: expect(compose(add_two, pow).call(2, 3)).to eq 10 ArgumentError: wrong number of arguments (2 for 1) # /tmp/d20151019-15631-k5upjh/solution.rb:12:in `block in compose' # /tmp/d20151019-15631-k5upjh/spec.rb:31:in `call' # /tmp/d20151019-15631-k5upjh/spec.rb:31:in `block (2 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>' Finished in 0.00275 seconds 4 examples, 3 failures Failed examples: rspec /tmp/d20151019-15631-k5upjh/spec.rb:2 # complement complements a function rspec /tmp/d20151019-15631-k5upjh/spec.rb:10 # complement complements a function with arity of two rspec /tmp/d20151019-15631-k5upjh/spec.rb:27 # compose returns a function composition with arity of two of two functions
FFFF Failures: 1) complement complements a function Failure/Error: not_answer = complement(is_answer) NoMethodError: undefined method `complement' for #<RSpec::Core::ExampleGroup::Nested_1:0x007f6722c98840> # /tmp/d20151019-15631-zlymoq/spec.rb:4:in `block (2 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>' 2) complement complements a function with arity of two Failure/Error: sum_not_four = complement(is_sum_four) NoMethodError: undefined method `complement' for #<RSpec::Core::ExampleGroup::Nested_1:0x007f6722c8eac0> # /tmp/d20151019-15631-zlymoq/spec.rb:12:in `block (2 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>' 3) compose returns a function composition of two functions Failure/Error: expect(compose(is_answer, add_two).call(40)).to eq true NoMethodError: undefined method `compose' for #<RSpec::Core::ExampleGroup::Nested_2:0x007f6722c6f4b8> # /tmp/d20151019-15631-zlymoq/spec.rb:24:in `block (2 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>' 4) compose returns a function composition with arity of two of two functions Failure/Error: expect(compose(add_two, pow).call(2, 3)).to eq 10 NoMethodError: undefined method `compose' for #<RSpec::Core::ExampleGroup::Nested_2:0x007f6722c6cf38> # /tmp/d20151019-15631-zlymoq/spec.rb:31:in `block (2 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>' Finished in 0.00199 seconds 4 examples, 4 failures Failed examples: rspec /tmp/d20151019-15631-zlymoq/spec.rb:2 # complement complements a function rspec /tmp/d20151019-15631-zlymoq/spec.rb:10 # complement complements a function with arity of two rspec /tmp/d20151019-15631-zlymoq/spec.rb:20 # compose returns a function composition of two functions rspec /tmp/d20151019-15631-zlymoq/spec.rb:27 # compose returns a function composition with arity of two of two functions
FF.. Failures: 1) complement complements a function Failure/Error: expect(not_answer.call(12)).to eq true expected: true got: false (compared using ==) # /tmp/d20151019-15631-991gmf/spec.rb:7:in `block (2 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>' 2) complement complements a function with arity of two Failure/Error: expect(sum_not_four.call(1, 2)).to eq true expected: true got: false (compared using ==) # /tmp/d20151019-15631-991gmf/spec.rb:15:in `block (2 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>' Finished in 0.008 seconds 4 examples, 2 failures Failed examples: rspec /tmp/d20151019-15631-991gmf/spec.rb:2 # complement complements a function rspec /tmp/d20151019-15631-991gmf/spec.rb:10 # complement complements a function with arity of two
.... Finished in 0.00263 seconds 4 examples, 0 failures
.... Finished in 0.00259 seconds 4 examples, 0 failures
.F.F Failures: 1) complement complements a function with arity of two Failure/Error: expect(sum_not_four.call(2, 2)).to eq false ArgumentError: wrong number of arguments (2 for 1) # /tmp/d20151019-15631-xscr0s/solution.rb:2:in `block in complement' # /tmp/d20151019-15631-xscr0s/spec.rb:14:in `call' # /tmp/d20151019-15631-xscr0s/spec.rb:14:in `block (2 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>' 2) compose returns a function composition with arity of two of two functions Failure/Error: expect(compose(add_two, pow).call(2, 3)).to eq 10 ArgumentError: wrong number of arguments (2 for 1) # /tmp/d20151019-15631-xscr0s/solution.rb:6:in `block in compose' # /tmp/d20151019-15631-xscr0s/spec.rb:31:in `call' # /tmp/d20151019-15631-xscr0s/spec.rb:31:in `block (2 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>' Finished in 0.00276 seconds 4 examples, 2 failures Failed examples: rspec /tmp/d20151019-15631-xscr0s/spec.rb:10 # complement complements a function with arity of two rspec /tmp/d20151019-15631-xscr0s/spec.rb:27 # compose returns a function composition with arity of two of two functions
.F.F Failures: 1) complement complements a function with arity of two Failure/Error: expect(sum_not_four.call(2, 2)).to eq false ArgumentError: wrong number of arguments (2 for 1) # /tmp/d20151019-15631-1cwtt9c/solution.rb:2:in `block in complement' # /tmp/d20151019-15631-1cwtt9c/spec.rb:14:in `call' # /tmp/d20151019-15631-1cwtt9c/spec.rb:14:in `block (2 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>' 2) compose returns a function composition with arity of two of two functions Failure/Error: expect(compose(add_two, pow).call(2, 3)).to eq 10 ArgumentError: wrong number of arguments (2 for 1) # /tmp/d20151019-15631-1cwtt9c/solution.rb:6:in `block in compose' # /tmp/d20151019-15631-1cwtt9c/spec.rb:31:in `call' # /tmp/d20151019-15631-1cwtt9c/spec.rb:31:in `block (2 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>' Finished in 0.00284 seconds 4 examples, 2 failures Failed examples: rspec /tmp/d20151019-15631-1cwtt9c/spec.rb:10 # complement complements a function with arity of two rspec /tmp/d20151019-15631-1cwtt9c/spec.rb:27 # compose returns a function composition with arity of two of two functions
.... Finished in 0.00264 seconds 4 examples, 0 failures
.... Finished in 0.00264 seconds 4 examples, 0 failures
.... Finished in 0.00259 seconds 4 examples, 0 failures
.... Finished in 0.00273 seconds 4 examples, 0 failures
.F.. Failures: 1) complement complements a function with arity of two Failure/Error: expect(sum_not_four.call(2, 2)).to eq false ArgumentError: wrong number of arguments (2 for 1) # /tmp/d20151019-15631-z5asyj/solution.rb:2:in `block in complement' # /tmp/d20151019-15631-z5asyj/spec.rb:14:in `call' # /tmp/d20151019-15631-z5asyj/spec.rb:14:in `block (2 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>' Finished in 0.00273 seconds 4 examples, 1 failure Failed examples: rspec /tmp/d20151019-15631-z5asyj/spec.rb:10 # complement complements a function with arity of two
.... Finished in 0.00282 seconds 4 examples, 0 failures
.... Finished in 0.00298 seconds 4 examples, 0 failures
.... Finished in 0.00266 seconds 4 examples, 0 failures
.... Finished in 0.00264 seconds 4 examples, 0 failures
.... Finished in 0.00264 seconds 4 examples, 0 failures
.... Finished in 0.00264 seconds 4 examples, 0 failures
.... Finished in 0.00264 seconds 4 examples, 0 failures
.... Finished in 0.00259 seconds 4 examples, 0 failures
.... Finished in 0.00304 seconds 4 examples, 0 failures
.... Finished in 0.0026 seconds 4 examples, 0 failures
..FF Failures: 1) compose returns a function composition of two functions Failure/Error: expect(compose(is_answer, add_two).call(40)).to eq true NoMethodError: undefined method `compose' for #<RSpec::Core::ExampleGroup::Nested_2:0x007f47344d4e50> # /tmp/d20151019-15631-17zed34/spec.rb:24:in `block (2 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>' 2) compose returns a function composition with arity of two of two functions Failure/Error: expect(compose(add_two, pow).call(2, 3)).to eq 10 NoMethodError: undefined method `compose' for #<RSpec::Core::ExampleGroup::Nested_2:0x007f47344b5ac8> # /tmp/d20151019-15631-17zed34/spec.rb:31:in `block (2 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>' Finished in 0.0027 seconds 4 examples, 2 failures Failed examples: rspec /tmp/d20151019-15631-17zed34/spec.rb:20 # compose returns a function composition of two functions rspec /tmp/d20151019-15631-17zed34/spec.rb:27 # compose returns a function composition with arity of two of two functions
.... Finished in 0.00269 seconds 4 examples, 0 failures
.... Finished in 0.00256 seconds 4 examples, 0 failures
.... Finished in 0.00261 seconds 4 examples, 0 failures
.... Finished in 0.00262 seconds 4 examples, 0 failures
.F.F Failures: 1) complement complements a function with arity of two Failure/Error: expect(sum_not_four.call(2, 2)).to eq false ArgumentError: wrong number of arguments (2 for 1) # /tmp/d20151019-15631-aoeady/solution.rb:2:in `block in complement' # /tmp/d20151019-15631-aoeady/spec.rb:14:in `call' # /tmp/d20151019-15631-aoeady/spec.rb:14:in `block (2 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>' 2) compose returns a function composition with arity of two of two functions Failure/Error: expect(compose(add_two, pow).call(2, 3)).to eq 10 ArgumentError: wrong number of arguments (2 for 1) # /tmp/d20151019-15631-aoeady/solution.rb:8:in `block in compose' # /tmp/d20151019-15631-aoeady/spec.rb:31:in `call' # /tmp/d20151019-15631-aoeady/spec.rb:31:in `block (2 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>' Finished in 0.00327 seconds 4 examples, 2 failures Failed examples: rspec /tmp/d20151019-15631-aoeady/spec.rb:10 # complement complements a function with arity of two rspec /tmp/d20151019-15631-aoeady/spec.rb:27 # compose returns a function composition with arity of two of two functions
.... Finished in 0.00261 seconds 4 examples, 0 failures
.... Finished in 0.00259 seconds 4 examples, 0 failures
.F.F Failures: 1) complement complements a function with arity of two Failure/Error: expect(sum_not_four.call(2, 2)).to eq false ArgumentError: wrong number of arguments (2 for 1) # /tmp/d20151019-15631-qxy3hm/solution.rb:2:in `block in complement' # /tmp/d20151019-15631-qxy3hm/spec.rb:14:in `call' # /tmp/d20151019-15631-qxy3hm/spec.rb:14:in `block (2 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>' 2) compose returns a function composition with arity of two of two functions Failure/Error: expect(compose(add_two, pow).call(2, 3)).to eq 10 ArgumentError: wrong number of arguments (2 for 1) # /tmp/d20151019-15631-qxy3hm/solution.rb:6:in `block in compose' # /tmp/d20151019-15631-qxy3hm/spec.rb:31:in `call' # /tmp/d20151019-15631-qxy3hm/spec.rb:31:in `block (2 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>' Finished in 0.00277 seconds 4 examples, 2 failures Failed examples: rspec /tmp/d20151019-15631-qxy3hm/spec.rb:10 # complement complements a function with arity of two rspec /tmp/d20151019-15631-qxy3hm/spec.rb:27 # compose returns a function composition with arity of two of two functions
.F.F Failures: 1) complement complements a function with arity of two Failure/Error: expect(sum_not_four.call(2, 2)).to eq false ArgumentError: wrong number of arguments (2 for 1) # /tmp/d20151019-15631-t5a350/solution.rb:2:in `block in complement' # /tmp/d20151019-15631-t5a350/spec.rb:14:in `call' # /tmp/d20151019-15631-t5a350/spec.rb:14:in `block (2 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>' 2) compose returns a function composition with arity of two of two functions Failure/Error: expect(compose(add_two, pow).call(2, 3)).to eq 10 ArgumentError: wrong number of arguments (2 for 1) # /tmp/d20151019-15631-t5a350/solution.rb:6:in `block in compose' # /tmp/d20151019-15631-t5a350/spec.rb:31:in `call' # /tmp/d20151019-15631-t5a350/spec.rb:31:in `block (2 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>' Finished in 0.00287 seconds 4 examples, 2 failures Failed examples: rspec /tmp/d20151019-15631-t5a350/spec.rb:10 # complement complements a function with arity of two rspec /tmp/d20151019-15631-t5a350/spec.rb:27 # compose returns a function composition with arity of two of two functions
.... Finished in 0.00304 seconds 4 examples, 0 failures
.F.F Failures: 1) complement complements a function with arity of two Failure/Error: expect(sum_not_four.call(2, 2)).to eq false ArgumentError: wrong number of arguments (2 for 1) # /tmp/d20151019-15631-17zx9uh/solution.rb:2:in `block in complement' # /tmp/d20151019-15631-17zx9uh/spec.rb:14:in `call' # /tmp/d20151019-15631-17zx9uh/spec.rb:14:in `block (2 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>' 2) compose returns a function composition with arity of two of two functions Failure/Error: expect(compose(add_two, pow).call(2, 3)).to eq 10 ArgumentError: wrong number of arguments (2 for 1) # /tmp/d20151019-15631-17zx9uh/solution.rb:6:in `block in compose' # /tmp/d20151019-15631-17zx9uh/spec.rb:31:in `call' # /tmp/d20151019-15631-17zx9uh/spec.rb:31:in `block (2 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>' # ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>' Finished in 0.00294 seconds 4 examples, 2 failures Failed examples: rspec /tmp/d20151019-15631-17zx9uh/spec.rb:10 # complement complements a function with arity of two rspec /tmp/d20151019-15631-17zx9uh/spec.rb:27 # compose returns a function composition with arity of two of two functions