<br><br><div class="gmail_quote">On Mon, Nov 21, 2011 at 12:00 PM, Jordan Schatz <span dir="ltr"><<a href="mailto:jordan@noionlabs.com">jordan@noionlabs.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Mon, Nov 21, 2011 at 06:32:18AM -0700, Jay McCarthy wrote:<br>
> I can imagine implementing something like...<br>
><br>
> (define record-formlet<br>
> (formlet<br>
> ;; Define the input format<br>
> ([name (hash-ref this 'name)]<br>
> [company (hash-ref this 'company)]<br>
> [address (hash-ref this 'company)]<br>
> [city (hash-ref this 'city)]<br>
> [state (hash-ref this 'state)]<br>
> [zip (hash-ref this 'zip)])<br>
> ;; Define the display format / input mapping<br>
> (#%# ,{(to-string (required (text-input))) . <=> . name}<br>
> ,{(to-string (required (text-input))) . <=> . company}<br>
> ,{(to-string (required (text-input))) . <=> . address}<br>
> ,{(to-string (required (text-input))) . <=> . city}<br>
> ,{(to-string (required (text-input))) . <=> . state}<br>
> ,{(to-string (required (text-input))) . <=> . zip})<br>
> ;; Define the output format<br>
> (values name company address city state zip)))<br>
><br>
</div><div class="im">> Does that seem more palatable?<br>
</div>Yes... In my usage I think I would always be giving it a hashtable, and<br>
getting a hashtable back, and the names on the right hand side of the<br>
formlet would correspond to the keys in the input and output hashtable.<br>
<br>
I see that it might not be generally useful and probably doesn't belong<br>
in web-server/formlets<br></blockquote><div><br></div><div>I'll put on my list of things to investigate.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im"><br>
> Your version that breaks mainly breaks because you are mutating the<br>
> record and recomputing the formlet, rather than saving the formlet in<br>
> the continuation for both the display and the processing.<br>
</div>So is this <a href="http://noionlabs.com/formlets/save-formlet.rkt" target="_blank">http://noionlabs.com/formlets/save-formlet.rkt</a> the general<br>
pattern of how others are writing their formlets? (using a maker /<br>
generator function to create a form with initial values, and keeping it<br>
in a variable for the processing step?)<br></blockquote><div><br></div><div>Basically, although I would not expect people to use mutation like that when binding will do:</div><div><br></div><div><a href="https://gist.github.com/1385592">https://gist.github.com/1385592</a></div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Are there any open sourced web apps built in racket where I could<br>
observer how people are using racket's features?<br></blockquote><div><br></div><div>Here's the last one I wrote</div><div><br></div><div><a href="https://github.com/jeapostrophe/m8b">https://github.com/jeapostrophe/m8b</a></div>
<div><br></div><div>Jay</div></div><br clear="all"><div><br></div>-- <br>Jay McCarthy <<a href="mailto:jay@cs.byu.edu" target="_blank">jay@cs.byu.edu</a>><br>Assistant Professor / Brigham Young University<br><a href="http://faculty.cs.byu.edu/~jay" target="_blank">http://faculty.cs.byu.edu/~jay</a><br>
<br>"The glory of God is Intelligence" - D&C 93<br>