On Mon, 1 Oct 2012, Mikko Tiihonen wrote:

[...]
(define make-pair
 (lambda (first)
   (lambda (second)
     (lambda (func)
       (func first) second))))
[...]
So, select-first returns the correct result when applied directly but returns the second argument when applied via make-pair. Also, I have checked that the implementation of make-pair gives the correct result if I do the beta-reduction by hand.
[...]

Hello Mikko,

the innermost lambda in make-pair consists of two expressions; it applies func to first for side effects and then it always returns second.

Probably you wanted to write
  ((func first) second)
instead of
  (func first) second

Ciao,
Thomas


--
When C++ is your hammer, every problem looks like your thumb.

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to