title: Scheme: How to check if all elements of a list are identical
body: <p>I'd like to create a Scheme function that yields true if it is passed a list that is composed entirely of identical elements. Such a list would be '(1 1 1 1). It would yield false with something like '(1 2 1 1).</p>
  
  <p>This is what I have so far:</p>
  
  <pre><code>    (define (list-equal? lst)
        (define tmp (car lst))
        (for-each (lambda (x) 
                     (equal? x tmp))
                   lst)
        )
  </code></pre>
  
  <p>Clearly this is incorrect, and I'm new to this. I guess I'm unable to express the step where I'm supposed to return <code>#t</code> or <code>#f</code>.</p>
  
  <p>Thanks in advance!</p>
  
  <p>EDIT: 
  I fiddled a bit and found a solution that seems to work very well, and with a minimal amount of code:</p>
  
  <pre><code>(define (list-equal? lst)
   (andmap (lambda (x) 
          (equal? x (car lst)))
        lst))
  </code></pre>
  
  <p>Thanks again for the help everyone.</p>