<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2963" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face="Courier New" size=2>Hi,</FONT></DIV>
<DIV><FONT face="Courier New" size=2>Are you aware of the fact that most scheme
compilers do some optimization for you? Straightforward code is easier optimized
than complicated code. Hand made optimization may even impede the optimizer of
the compiler. Because you have no more than 2.5 month of experience, I
suggest that you focus on good style first and follow the guidelines of HTDP.
</FONT></DIV>
<DIV><FONT face="Courier New" size=2>Jos Koot</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV>((((lambda(x)((((((x x)x)x)x)x)x))<BR> (lambda(x)(lambda(y)(x(x
y)))))<BR> (lambda(x)(write x)x))<BR> "greetings, Jos") </DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=albert.neu@gmail.com href="mailto:albert.neu@gmail.com">Albert
Neumüller</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=plt-scheme@list.cs.brown.edu
href="mailto:plt-scheme@list.cs.brown.edu">plt-scheme@list.cs.brown.edu</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Tuesday, September 19, 2006 4:50
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> [plt-scheme] Re: Scheme
efficiency guidelines (or: the fastest wayto calc a cartesian product)</DIV>
<DIV><BR></DIV>Hello again!<BR><BR>(cartesian-product1c can be further
optimized (or not?) as is shown in<BR>cartesian-product1d
below)<BR><BR>Concerning cartesian-product1c: Instead of passing x-single as
a<BR>parameter the whole time, we create a local
expression:<BR><BR>;;===================================================<BR>;;cartesian-product1d
: (listof SV) -> (listof onepair)<BR>(define (cartesian-product1d
alist)<BR> (local ((define (do-cartesian1d x-single
x-rest)<BR>
(local ((define (cartesian-with-fixed-x1d
y)<BR>
(cond<BR>
[(empty? y)
(cond<BR>
[(empty? x-rest)
empty]<BR>
[else (do-cartesian1d (first<BR>x-rest) (rest
x-rest))])]<BR>
[else (cons (make-onepair x-single (first
y))<BR>
(cartesian-with-fixed-x1d (rest
y)))])))<BR>
(cartesian-with-fixed-x1d alist))))<BR>
(cond<BR> [(empty? alist)
empty]<BR> [else (do-cartesian1d (first alist)
(rest
alist))])))<BR>;;===================================================<BR><BR>Kind
regards,<BR>Albert
Neumüller<BR>_________________________________________________<BR> For
list-related administrative tasks:<BR> <A
href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme">http://list.cs.brown.edu/mailman/listinfo/plt-scheme</A></BLOCKQUOTE></BODY></HTML>