# Exercise: The keep Combinator
#
# keep runs a quotation on the top value, then restores the original.
#
# Stack effect: ( ..a x [..a x -- ..b] -- ..b x )
#
# Think of it as: "compute something from x, but don't lose x."
#
# Examples:
#   5 [ dup i.* ] keep     → ( 25 5 )  — squared it, kept original
#   3 [ 2 i.+ ] keep       → ( 5 3 )   — added 2, kept original
#
# This replaces the common pattern: dup [ ... ] dip
#
# Your task: Use keep to compute the square of 7 while
# preserving the original 7.
# When done, delete the marker line below.

# I AM NOT DONE

: test-keep ( -- )
    # Stack starts: ( 7 )
    # Goal: square it but keep original
    # Result: ( 49 7 )
    7
    # Your code here
    drop 0

    # Do not edit below this line
    # Top should be 7 (preserved)
    7 test.assert-eq
    # Second should be 49 (squared)
    49 test.assert-eq
;
