title: How do I define functions using Racket macros?
body: <p>I am trying to write a macro that defines a special class of data structure with associated functions.</p>
  
  <p>I know this is possible; it is done multiple times in the core language itself.</p>
  
  <p>As a specific example, how would I define the <code>define-struct</code> macro in Scheme itself. It needs to create <code>make-struct</code>, <code>struct-&lt;&lt;field&gt;&gt;</code>, etc functions.</p>
  
  <p>I tried doing this using <code>define</code>, however, this only defines the function in the macro's lexical scope.</p>
  
  <p>How can I actually define a function in a macro?</p>