[racket] A VAT calculator using Racket web server

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Mon Sep 6 12:05:31 EDT 2010

I agree with Noel.

As far as make-url, send/suspend/dispatch captures a continuation, but
unless you create a request handler that returns to it (via make-url),
it is not stored or bound to any URL.

Jay

On Mon, Sep 6, 2010 at 6:05 AM, Noel Welsh <noelwelsh at gmail.com> wrote:
> I made some brief notes, which I reproduce below ('cause I'm too lazy
> to write them out again):
>
> ;; NHW
> ;; This function is odd. Its type is
> ;;  (U Number String) -> (U Number String)
> ;; which is almost certainly not what you want.
> (define (as-number x)
>  (if (number? x)
>     x
>     (safely (string->number x))))
>
> ;;; STATE is whatever we choose to manage outselves, in whatever form.
> ;; NHW
> ;; Nope. State is a list with at least two elements. If it ain't,
> calculating amount and rate will cause errors.
>
>
> On Mon, Sep 6, 2010 at 11:48 AM, Mark Carter <mcturra2000 at yahoo.co.uk> wrote:
>> The questions I'd like to ask specifically at this point are:
>> * should state (in my case the user's input for amount and tax rate) be passed
>> as a separate parameter in the function definition, or is it better to pack it
>> in with the request?
>
> I don't quite understand the question. Should state be separate
> parameter to vat-page? Yes, it is much clearer if it is. While you're
> at it, split out amount and rate into two parameters. vat-page makes
> no use of the request, anyway.
>
>> * is there a better way of writing button-clicked? The function is doing a lot
>> of work of hand-decoding the request and repacking it - that seems inelegant
>
> You might be interested in formlets.
>
>> * I'm a little puzzled as to what the deal is with the parameter make-url. I'm
>> thinking that has something to do with creating the "continuation" behind the
>> scenes??
>
> Yeah. IIRC, the continuation ID is not know till you start sending the
> response (i.e. call send/suspend or variants) so you can't embed any
> callback URLs till that time. make-url generates the URLs.
>
> HTH,
> N.
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>



-- 
Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University
http://teammccarthy.org/jay

"The glory of God is Intelligence" - D&C 93


Posted on the users mailing list.