title: Racket: extracting field ids from structures
body: <p>I want to see if I can map Racket structure fields to columns in a DB.  </p>
  
  <p>I've figured out how to extract accessor functions from structures in PLT scheme using the fourth return value of:</p>
  
  <pre><code>(struct-type-info)
  </code></pre>
  
  <p>However the returned procedure indexes into the struct using an integer.   Is there some way that I can find out what the field names were at point of definition?  Looking at the documentation it seems like this information is "forgotten" after the structure is defined and exists only via the generated-accessor functions: <code>(&lt;id&gt;-&lt;field-id&gt; s)</code>.   </p>
  
  <p>So I can think of two possible solutions:</p>
  
  <ol>
  <li>Search the namespace symbols for ones that start with my struct name (yuk);</li>
  <li>Define a custom define-struct macro that captures the ordered sequence of field-names inside some hash that is keyed by struct name (eek).</li>
  </ol>