<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<div><br></div><div><blockquote type="cite" class=""><div>> (foldl (lambda (x y) ( + x (* y 10) )) 0 '(1 2 3))</div><div>123</div></blockquote><br></div><div>-- Matthias</div><div><br></div><div><br></div><br><div><div>On Feb 16, 2009, at 8:21 PM, Tim Wawrzynczak wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">I think you're looking for something like this?<br><br>(foldr (lambda (x y) ( + x (* y 10) )) 0 (reverse '(1 2 3)))<br> = 123<br><br> - inforichland<br><br><div class="gmail_quote">On Mon, Feb 16, 2009 at 7:08 PM, Thomas Chust <span dir="ltr"><<a href="mailto:chust@web.de">chust@web.de</a>></span> wrote:<br> <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">2009-02-16 aditya shukla <<a href="mailto:adityashukla1983@gmail.com">adityashukla1983@gmail.com</a>>:<br> > [...]<br> <div class="Ih2E3d">> (define guess (lambda(lsb csb msb)<br> > This is the part which i was not able to do , how can i combine lsb<br> > , csb and msb so the number is of the form (msbcsblsb) .Is there any<br> > function in scheme which can do this<br> ><br> > ))<br> </div>> [...]<br> <br> Hello,<br> <br> there are indeed functions in Scheme that can be used do this -- they<br> are called + and * ;-)<br> <br> All you need to do is multiply each digit of the number with the value<br> of its position and add up the results. If you want to create a more<br> general solution for an arbitrary number of digits, a function like<br> foldr comes in handy, too.<br> <br> cu,<br> Thomas<br> <font color="#888888"><br> <br> --<br> When C++ is your hammer, every problem looks like your thumb.<br> _________________________________________________<br> For list-related administrative tasks:<br> <a href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme" target="_blank">http://list.cs.brown.edu/mailman/listinfo/plt-scheme</a><br> </font></blockquote></div><br><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">_________________________________________________</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span class="Apple-converted-space"> </span>For list-related administrative tasks:</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span class="Apple-converted-space"> </span><a href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme">http://list.cs.brown.edu/mailman/listinfo/plt-scheme</a></div> </blockquote></div><br></body></html>