[plt-scheme] How to do this code refactor?

From: Grant Rettke (grettke at acm.org)
Date: Mon Jul 30 08:45:10 EDT 2007

Hi folks,

A while back in an unrelated thread there was an explanation of how to
do a code refactor of something like this using DrSchemes key

Suppose you have this code:

(define (hw)
  (printf "Hello, ")
  (printf "world."))

And you want to wrap the printf-s with a begin block.

My solution was:

(m:s:right) Select forward sexp
(c:x) 		Cut
(m:s:()		Insert matching parentheses
(c:v)		Paste
(c:i)		Reformat

I seem to recall Eli posting a much nicer solution than this, though.

Anyone remember that post?

Posted on the users mailing list.