<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi, Jim, Robby and Thomas!<div><br></div><div>Problem solved - case of "late night eyes" after all :) Thank you!</div><div><br></div><div>Best,</div><div><br></div><div>Mikko<br><div apple-content-edited="true"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div><br></div></span></div><div><div>On 1.10.2012, at 1:01, Jim Bender wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>You are missing a pair of parens around '(func first)' and 'second'. The current code in your message will return second, no matter what function you pass in as 'func'.<br><br>The correct definition for make-pair should be:<br><br><blockquote type="cite">define make-pair<br></blockquote><blockquote type="cite"> (lambda (first)<br></blockquote><blockquote type="cite"> &nbsp;&nbsp;(lambda (second)<br></blockquote><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;(lambda (func)<br></blockquote><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;((func first) second)))))<br></blockquote><br><br>Jim<br><br>On Sep 30, 2012, at 4:43 PM, Mikko Tiihonen &lt;<a href="mailto:mikko.tiihonen@tmtiihonen.fi">mikko.tiihonen@tmtiihonen.fi</a>&gt; wrote:<br><br><blockquote type="cite">Hi!<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I have been going through some lambda-calculus exercises with Racket. I have stumbled on a puzzling problem where beta-reduction by hand leads &nbsp;to different result from that generated by Racket. <br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">(define select-first<br></blockquote><blockquote type="cite"> (lambda (first)<br></blockquote><blockquote type="cite"> &nbsp;&nbsp;(lambda (second)<br></blockquote><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;first)))<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">(define select-second<br></blockquote><blockquote type="cite"> (lambda (first)<br></blockquote><blockquote type="cite"> &nbsp;&nbsp;(lambda (second)<br></blockquote><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;second)))<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">(define make-pair<br></blockquote><blockquote type="cite"> (lambda (first)<br></blockquote><blockquote type="cite"> &nbsp;&nbsp;(lambda (second)<br></blockquote><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;(lambda (func)<br></blockquote><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(func first) second))))<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">-----<br></blockquote><blockquote type="cite"><blockquote type="cite">((select-first 'a) 'b)<br></blockquote></blockquote><blockquote type="cite">'a<br></blockquote><blockquote type="cite"><blockquote type="cite">((select-second 'a) 'b)<br></blockquote></blockquote><blockquote type="cite">'b<br></blockquote><blockquote type="cite"><blockquote type="cite">(((make-pair 'a) 'b) select-first)<br></blockquote></blockquote><blockquote type="cite">'b<br></blockquote><blockquote type="cite"><blockquote type="cite">(((make-pair 'a) 'b) select-second)<br></blockquote></blockquote><blockquote type="cite">'b<br></blockquote><blockquote type="cite">-------<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">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.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I suspect that I'm missing something obvious, but I really cannot find the reason why make-pair misbehaves - you gurus on this mailing-list probably can pinpoint the problem instantly :)<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Best regards,<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">-Mikko Tiihonen<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">P.S. &nbsp;Having used Racket for some months now, I find both Racket and the community around it really great!<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">____________________<br></blockquote><blockquote type="cite"> Racket Users list:<br></blockquote><blockquote type="cite"> <a href="http://lists.racket-lang.org/users">http://lists.racket-lang.org/users</a><br></blockquote></div></blockquote></div><br></div></div></body></html>