<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Our local community has a funky tax form not handled by the big tax prep vendors. So I rolled my own with Racket. It outputs LaTeX so I have something to submit all ready.<div><br></div><div>Well it would, except I have goofed something up. I'm eval'ing a symbol (probably incorrect). The symbol comes not from the top-level, but from a module. I'm forming a symbol 'line1-gsk. I want the value of the identifier represented by that symbol. How do I do that? (If my son were back from school, I'd ask him...)</div><div><br></div><div>Geoff</div><div><br></div><div><span style="font-family: Monaco; font-size: small;">line1-gsk: undefined;</span></div><div><font face="Monaco" size="2"> cannot reference undefined identifier<br> context...:<br> /Users/gknauth/me/2014/taxes/TY2013/ipt-latex.rkt:50:2: for-loop<br> /Users/gknauth/me/2014/taxes/TY2013/ipt-latex.rkt:49:0: pr-table-rows<br> /Users/gknauth/me/2014/taxes/TY2013/ipt-latex.rkt:35:0: pr-table<br> /Users/gknauth/me/2014/taxes/TY2013/ipt-hdr-gsk.rkt: [running body]<br></font><div><font face="Monaco" size="2"><br></font></div><div style="font-size: 14px;"><font face="Monaco" size="2" style="font-size: 12px;">ipt-data.rkt:</font></div><div><font face="Monaco" size="2">(provide (all-defined-out))<br></font><font face="Monaco" size="2">(define line1-gsk (round (+ 111 222 333)))</font></div><div><font face="Monaco"><font size="2">; I want this value, line1-gsk, to be picked up in pr-table-row below</font><br></font><div><font face="Monaco" size="2"><br></font></div><div style="font-size: 14px;"><span style="font-size: 12px; font-family: Monaco;">ipt-latex.rkt:</span></div></div><div><font face="Monaco" size="2">(require (lib "48.ss" "srfi"))<br>(require "ipt-data.rkt")<br>(provide (all-defined-out))<br>...</font></div><div><font face="Monaco" size="2">(define (pr-table-row lineno whoisa whoisb) ; whoisa is "gsk" (me), whoisb is my spouse<br> (let* ((base-str (string-append "line" (number->string lineno) "-"))</font></div><div><font face="Monaco" size="2"> ;;;;;; ERROR FIRST HAPPENS HERE ;;;;;;<br><span class="Apple-tab-span" style="white-space:pre"> </span> (amt-a (eval (string->symbol (string-append base-str whoisa))))</font></div><div><font face="Monaco" size="2"> ;;;;;; (eval 'line1-gsk) ;;;;;;<br><span class="Apple-tab-span" style="white-space:pre"> </span> (amt-b (eval (string->symbol (string-append base-str whoisb))))<br><span class="Apple-tab-span" style="white-space:pre"> </span> (what (eval (string->symbol (string-append base-str "what"))))<br><span class="Apple-tab-span" style="white-space:pre"> </span> (desc (eval (string->symbol (string-append base-str "desc")))))<br> (printf<br> (string-append<br> (number->string lineno) "&"<br> what "&"<br> <br> (number->string lineno) "&"<br> "\\texttt{" (format "~9,2F" amt-a) "}&"<br> "\\texttt{" (format "~9,2F" amt-b) "}"<br> (if desc<br><span class="Apple-tab-span" style="white-space:pre"> </span> (string-append "\\\\&{\\small " desc "}&&&")<br><span class="Apple-tab-span" style="white-space:pre"> </span> "")<br> "\\\\\\hline\n"))))</font></div></div></body></html>