# Exercise: Refactoring with Words
#
# When you see repeated patterns, extract them into words.
# This is the essence of abstraction.
#
# Before refactoring:
#   x dup i.* 2 i.+
#   y dup i.* 2 i.+
#   z dup i.* 2 i.+
#
# After refactoring:
#   : transform ( Int -- Int ) dup i.* 2 i.+ ;
#   x transform
#   y transform
#   z transform
#
# Your task: The test uses a repeated pattern.
# Define `increment-double` that adds 1, then doubles.
# Pattern: 1 i.+ dup i.+
# When done, delete the marker line below.

# I AM NOT DONE

: increment-double ( Int -- Int )
    # Your code here: add 1, then double
    drop 0
;

: test-refactor ( -- )
    5 increment-double
    # Do not edit below this line
    12 test.assert-eq   # (5+1)*2 i.= 12
;
