--- /dev/null
+USING: central help.markup help.syntax ;
+
+HELP: CENTRAL:
+{ $description
+ "This parsing word defines a pair of words useful for "
+ "implementing the \"central\" pattern: " { $snippet "symbol" } " and "
+ { $snippet "with-symbol" } ". This is a middle ground between excessive "
+ "stack manipulation and full-out locals, meant to solve the case where "
+ "one object is operated on by several related words."
+} ;
\ No newline at end of file
--- /dev/null
+USING: central tools.test ;
+
+IN: scratchpad
+
+CENTRAL: test-central
+
+[ 3 ] [ 3 [ test-central ] with-test-central ] unit-test
\ No newline at end of file
--- /dev/null
+USING: kernel lexer namespaces parser sequences words ;
+
+IN: central
+
+: define-central-getter ( word -- )
+ dup [ get ] curry (( -- obj )) define-declared ;
+
+: define-central-setter ( word with-word -- )
+ [ with-variable ] with (( object quot -- )) define-declared ;
+
+: define-central ( word-name -- )
+ [ create-in dup define-central-getter ] keep
+ "with-" prepend create-in [ define-central-setter ] keep
+ make-inline ;
+
+SYNTAX: CENTRAL: ( -- ) scan define-central ;
\ No newline at end of file