Ticket #719: request-vars-getter-with-no-arguments-case-lambda.diff

File request-vars-getter-with-no-arguments-case-lambda.diff, 900 bytes (added by Moritz Heidkamp, 10 years ago)

the same using case-lambda, slightly more readable IMHO

  • spiffy-request-vars.scm

     
    120120                 ((request-body) request-body)
    121121                 ((query-string) query-string-vars)
    122122                 (else (error 'request-vars (conc "Unkown source: " source))))))
    123 
    124     (lambda (var #!optional default/converter)
     123    (case-lambda
     124     (() vals)
     125     ((var #!optional default/converter)
    125126      (let* ((var (if (string? var)
    126127                      (string->symbol var)
    127128                      var)))
     
    130131            (let ((vals (req-vars/vals var vals)))
    131132              (if (null? vals)
    132133                  default/converter
    133                   (car vals))))))))
     134                  (car vals)))))))))
    134135
    135136(define-syntax with-request-vars*
    136137  (syntax-rules ()