title: Could these be used as Racket definitions for cons, first, and rest?
body: <p>I am trying to follow along this Racket tutorial:</p>
  <p><a href="https://cs.uwaterloo.ca/%7Eplragde/flaneries/TYR/Pure_Functional_Programming.html" rel="nofollow noreferrer">https://cs.uwaterloo.ca/~plragde/flaneries/TYR/Pure_Functional_Programming.html</a></p>
  <p>and it describes these alternatives to the actual implementations.  I know what <code>cons</code>, <code>first</code> and <code>rest</code> do, and I understand how lambda functions work, but I cannot figure out how these successfully implement <code>cons</code>, <code>first</code> and <code>rest</code>.</p>
  <pre><code>(define (cons f r) (lambda (b) (if b f r)))
  (define (first lst) (lst true))
  (define (rest lst) (lst false))
  </code></pre>
  <p>Maybe I have misinterpretted what they are supposed to be.  Here is what the tutorial says:</p>
  <blockquote>
  <p>As another example of the use of closures, consider the following &quot;alternative&quot; implementation of the basic list primitives.</p>
  </blockquote>
  <p>Could someone clarify?</p>