From ed57fac2de48c7a86536ae22c77540f787d49a81 Mon Sep 17 00:00:00 2001 From: Matthew Hall Date: Sun, 26 Mar 2023 15:27:41 +1300 Subject: Refactoring --- spec/practical/bf_spec.cr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/practical/bf_spec.cr') diff --git a/spec/practical/bf_spec.cr b/spec/practical/bf_spec.cr index cd14c59..d1ad488 100644 --- a/spec/practical/bf_spec.cr +++ b/spec/practical/bf_spec.cr @@ -122,13 +122,13 @@ describe "brainfuck parser" do end shift_block = (Parser.token('<') | Parser.token('>')).some.map do |cs| - left_count = cs.count { |c| c == '<' } + left_count = cs.count(&.==('<')) right_count = cs.size - left_count {type: BFOpType::Shift, amount: right_count - left_count} end add_block = (Parser.token('+') | Parser.token('-')).some.map do |cs| - minus_count = cs.count { |c| c == '-' } + minus_count = cs.count(&.==('-')) plus_count = cs.size - minus_count {type: BFOpType::Add, amount: plus_count - minus_count} end -- cgit v1.2.1