title: What is the difference between define vs define-syntax and let vs let-syntax when value is syntax-rules?
body: <p>I'm in a process of implementing Hygienic macros in my Scheme implementation, I've just implemented <code>syntax-rules</code>, but I have this code:</p>
  
  <pre><code>(define odd?
    (syntax-rules ()
      ((_ x) (not (even? x)))))
  </code></pre>
  
  <p>what should be the difference between that and this:</p>
  
  <pre><code>(define-syntax odd?
    (syntax-rules ()
      ((_ x) (not (even? x)))))
  </code></pre>
  
  <p>from what I understand <code>syntax-rules</code> just return syntax transformer, why you can't just use <code>define</code> to assign that to symbol? Why I need to use <code>define-syntax</code>? What extra stuff that expression do?</p>
  
  <p>Should first also work in scheme? Or only the second one?</p>
  
  <p>Also what is the difference between <code>let</code> vs <code>let-syntax</code> and <code>letrec</code> vs <code>letrec-syntax</code>. Should <code>(define|let|letrec)-syntax</code> just typecheck if the value is syntax transformer?</p>
  
  <p><strong>EDIT</strong>:</p>
  
  <p>I have this implementation, still using lisp macros:</p>
  
  <pre><code>;; -----------------------------------------------------------------------------
  (define-macro (let-syntax vars . body)
    `(let ,vars
       ,@(map (lambda (rule)
                `(typecheck "let-syntax" ,(car rule) "syntax"))
              vars)
       ,@body))
  
  ;; -----------------------------------------------------------------------------
  (define-macro (letrec-syntax vars . body)
    `(letrec ,vars
       ,@(map (lambda (rule)
                `(typecheck "letrec-syntax" ,(car rule) "syntax"))
              vars)
       ,@body))
  
  ;; -----------------------------------------------------------------------------
  (define-macro (define-syntax name expr)
    (let ((expr-name (gensym)))
      `(define ,name
         (let ((,expr-name ,expr))
           (typecheck "define-syntax" ,expr-name "syntax")
           ,expr-name))))
  </code></pre>
  
  <p>This this code correct?</p>
  
  <p>Should this code works?</p>
  
  <pre><code>(let ((let (lambda (x) x)))
    (let-syntax ((odd? (syntax-rules ()
                          ((_ x) (not (even? x))))))
       (odd? 11)))
  </code></pre>