ovidiu      01/12/14 12:37:32

  Modified:    scratchpad/schecoon/scheme sitemap.scm
  Log:
  Use lambda functions in all the places instead of implicitly assuming them.
  
  Revision  Changes    Path
  1.2       +16 -12    xml-cocoon2/scratchpad/schecoon/scheme/sitemap.scm
  
  Index: sitemap.scm
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/scratchpad/schecoon/scheme/sitemap.scm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- sitemap.scm       2001/12/13 09:25:42     1.1
  +++ sitemap.scm       2001/12/14 20:37:32     1.2
  @@ -22,7 +22,10 @@
   ;;
   ;; Pipelines are simply functions that accept arguments. These
   ;; arguments are usually passed from the sitemap, where they are
  -;; computed usually from the HTTP request.
  +;; computed usually from the HTTP request. These functions should
  +;; accept a variable number of arguments. This is because the actual
  +;; values for the parameters are generated as result of the pattern
  +;; matching.
   ;;
   ;; Below is an example of how pipelines definition look in
   ;; Scheme. Another Scheme module is responsible to mapping the
  @@ -32,7 +35,7 @@
   ;;(define pipelines
   ;;  (define-pipelines
   ;;    (define-pipeline docbook-xhtml
  -;;      (lambda (file)
  +;;      (lambda (file . args)
   ;;    (generate file)
   ;;    (transform '((type xslt)
   ;;                 (name "docbook2xhtml.xsl")
  @@ -40,7 +43,7 @@
   ;;    (serialize (type xml))))
   ;;
   ;;    (define-pipeline gif-image
  -;;      (lambda (file)
  +;;      (lambda (file . args)
   ;;    (read (concat "src/" file ".gif") "image/gif")))
   ;;    ))
   ;;
  @@ -67,7 +70,7 @@
   (define-syntax define-pipeline
     (lambda (x)
       (syntax-case x ()
  -     ((_) '())
  +     ((_) (syntax #f))
        ((_ name body)
         (syntax (cons (quote name) body))))))
   
  @@ -79,15 +82,16 @@
   ;;(define the-sitemap
   ;;  (define-sitemap
   ;;    (match "sql/.*"
  -;;           (call-pipeline docbook-xhtml "\\1"))
  +;;           (call-pipeline docbook-xhtml))
   ;;
   ;;    (match "slides/.*\.gif"
  -;;           (call-pipeline gif-image "\\1"))
  +;;           (call-pipeline gif-image))
   ;;
  -;;    (match "view-source/*"
  -;;           (generate "\\1"))
  -;;           (transform '((type xslt) (name "xsp"))))
  -;;           (serialize (type xml))))
  +;;    (match "view-source/(*).(*)"
  +;;           (lambda (file type . args)
  +;;             (generate "\\1"))
  +;;             (transform '((type xslt) (name "xsp"))))
  +;;             (serialize (type xml)))))
   ;;
   ;;    (match "shopping-cart"
   ;;      (shopping-cart))
  @@ -104,12 +108,12 @@
   (define-syntax match
     (lambda (x)
       (syntax-case x ()
  -     ((_ pattern expression ...)
  +     ((_ pattern expression)
         (syntax (let ((regexp (pregexp pattern)))
                (lambda (url)
                  (let ((result (pregexp-match regexp url)))
                    (if result
  -                     (begin expression ...)
  +                     (apply expression (cdr result))
                        #f))))))
        )))
   
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to