<?xml version="1.0"?>
<paste-with-annotations>
  <paste>
    <number>
      <integer>82939</integer>
    </number>
    <user>
      <string>hkBst</string>
    </user>
    <title>
      <string>curried macros?</string>
    </title>
    <contents>
      <string>Given

((wrap +) macro-to-be-ignored arguments)

I would like to define wrap like so

(define-syntax wrap
  (syntax-rules ()
    ((_ f)
     (let-syntax ((ret (syntax-rules ()
			 ((_ c . a)
			  (f . a)))))
       ret))))

but this is invalid. Is there another way I can write wrap? Wrap must be a macro if it is to run before macro-to-be-ignored such that it can throw it away.</string>
    </contents>
    <universal-time>
      <integer>3455594891</integer>
    </universal-time>
    <channel>
      <string>#scheme</string>
    </channel>
    <colorization-mode>
      <string>Scheme</string>
    </colorization-mode>
    <maybe-spam>
      <null/>
    </maybe-spam>
    <is-unicode>
      <keyword>TRUE</keyword>
    </is-unicode>
    <deletion-requested>
      <null/>
    </deletion-requested>
    <deletion-requested-email>
      <null/>
    </deletion-requested-email>
    <expiration-time>
      <null/>
    </expiration-time>
  </paste>
  <annotation>
    <number>
      <integer>1</integer>
    </number>
    <user>
      <string>hkBst</string>
    </user>
    <title>
      <string>wrap-macro in scheme48</string>
    </title>
    <contents>
      <string>; $ scheme48 -a batch &lt;&lt;&lt;$'(load &quot;macro-scheme48.scm&quot;)'

(define-syntax macro:id
  (syntax-rules ()
    ((_ a) a)))

(define-syntax macro:apply
  (syntax-rules (macro:continuation)
    ((_ (macro:continuation cont) f a ... (l e ...))
     (let-syntax ((_cont (syntax-rules ()
			   ((_ (_e (... ...)))
			    (f (macro:continuation cont) a ... _e (... ...))))))
       (l (macro:continuation _cont) e ...)))
    ((_ f a ... (l e ...))
     (let-syntax ((_cont (syntax-rules ()
			   ((_ (_e (... ...)))
			    (f a ... _e (... ...))))))
       (l (macro:continuation _cont) e ...)))))

(define-syntax macro:list
  (syntax-rules (macro:continuation)
    ((_ (macro:continuation cont) e ...)
     (cont (e ...)))))

(define-syntax macro:wrap
  (syntax-rules ()
    ((_ f)
     (let-syntax ((ret (syntax-rules ()
			 ((_ c . a)
			  (f . a)))))
       ret))))

(define (pretty-print x) (display x) (newline))

(pretty-print (macro:apply + 3 (macro:list 1 2 3)))
(pretty-print (macro:apply (macro:continuation macro:id) (macro:wrap +) 3 (macro:list 1 2 3)))
(pretty-print (apply + 3 (list 1 2 3)))

;==================================

$ scheme48 -a batch &lt;&lt;&lt;$'(load &quot;macro-scheme48.scm&quot;)'
macro-scheme48.scm                                                                                 

Warning: segment matching not implemented
         (a ... (l e ...))
         (&amp;syntax-error)

Warning: segment matching not implemented
         (a ... (l e ...))
         (&amp;syntax-error)

Warning: segment matching not implemented
         (a ... (l e ...))
         (&amp;syntax-error)

Warning: too many ...'s
         (... ...)
         (&amp;syntax-error)

Warning: too many ...'s
         (... ...)
         (&amp;syntax-error)

Warning: too many ...'s
         (e ...)
         (&amp;syntax-error)

Warning: segment matching not implemented
         (a ... (l e ...))
         (&amp;syntax-error)

Warning: segment matching not implemented
         (a ... (l e ...))
         (&amp;syntax-error)

Warning: segment matching not implemented
         (a ... (l e ...))
         (&amp;syntax-error)

Warning: too many ...'s
         (... ...)
         (&amp;syntax-error)

Warning: too many ...'s
         (... ...)
         (&amp;syntax-error)

Warning: too many ...'s
         (e ...)
         (&amp;syntax-error)

Warning: segment matching not implemented
         (a ... (l e ...))
         (&amp;syntax-error)

Warning: segment matching not implemented
         (a ... (l e ...))
         (&amp;syntax-error)

Warning: invalid expression
         (#{Generated l 480} (#{Generated macro:continuation 480} #{Generated _cont 480}) . syntax-error)
         (&amp;syntax-error)

Warning: invalid expression
         (#{Generated l 482} (#{Generated macro:continuation 482} #{Generated _cont 482}) . syntax-error)
         (&amp;syntax-error)
syntax-error
syntax-error
9
#{Unspecific}

</string>
    </contents>
    <universal-time>
      <integer>3455646549</integer>
    </universal-time>
    <channel>
      <string>#scheme</string>
    </channel>
    <colorization-mode>
      <string></string>
    </colorization-mode>
    <maybe-spam>
      <null/>
    </maybe-spam>
    <is-unicode>
      <keyword>TRUE</keyword>
    </is-unicode>
    <deletion-requested>
      <null/>
    </deletion-requested>
    <deletion-requested-email>
      <null/>
    </deletion-requested-email>
    <expiration-time>
      <null/>
    </expiration-time>
  </annotation>
</paste-with-annotations>
