title: Unreachable Ill-formed if-expression is syntax error in Scheme but not in Common Lisp
body: <p>I'm trying to get a better understanding of how S-expressions are evaluated in different lisps and wanted to see they would handle interesting ill-formed expressions. I get that Common Lisp and Scheme are totally different languages, but is there a specific difference in their semantics that explains the difference in behavior. For example, Lisp-1s and Lisp-2s have observable differences in their behavior, as do hygienic vs non-hygienic macro systems.</p>
  
  <p>I have a program containing an unreachable ill-formed <em>if</em> expression in Scheme and Common Lisp.</p>
  
  <pre><code>;; foo.scm
  (if #t 1 (if))
  
  (display "12")
  </code></pre>
  
  <p>And the Common Lisp version</p>
  
  <pre><code>;; foo.lisp
  (if t 1 (if))
  
  (display "12")
  </code></pre>
  
  <p><code>chicken</code> and <code>guile</code> both produce a syntax error.</p>
  
  <p>Chicken:</p>
  
  <pre><code>% chicken foo.scm
  
  Syntax error: (foo.scm:1) in `if' - pair expected
  
      (if)
  
      Expansion history:
  
      &lt;syntax&gt;      (##core#begin (if #t 1 (if)))
      &lt;syntax&gt;      (if #t 1 (if))
      &lt;syntax&gt;      (##core#if #t 1 (if))
      &lt;syntax&gt;      (if)  &lt;--
  </code></pre>
  
  <p>Guile:</p>
  
  <pre><code>% guile foo.scm
  ...
  .../foo.scm:1:9: source expression failed to match any pattern in form (if)
  </code></pre>
  
  <p><code>sbcl</code> and <code>clisp</code> both print 12 and emit no warnings.</p>
  
  <p>SBCL:</p>
  
  <pre><code>% sbcl --load foo.lisp
  This is SBCL 1.3.11, an implementation of ANSI Common Lisp.
  ...
  12
  0]^D
  </code></pre>
  
  <p>CLISP</p>
  
  <pre><code>% clisp foo.lisp
  
  "12"
  </code></pre>