
<HTML><HEAD><TITLE>CosmicOS message</TITLE></HEAD>
<BODY BGCOLOR='#ffffff'>
<HR>
<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT><TT><A NAME='20'><FONT COLOR=red>#&nbsp;MATH show map function for applying a function across the elements of a list</FONT></A></TT><BR>
<TT>[<A HREF='sound.cgi?s=211013210101013023211010322101011032111011332211113221132211110130232111011332033221111113221010110322111010302321110113332210101013221010110332211110030232111011333322100003332233'>hear</A>] </TT><TT>(define map /</TT><BR>
<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT><TT>&nbsp;&nbsp;lambda <font style='background-color: #cdffff'>(p lst)</font></TT><BR>
<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT><TT>&nbsp;&nbsp;&nbsp;<font style='background-color: #ffcdff'>(if </font><font style='background-color: #ff9bff'>(&gt; </font><font style='background-color: #ff69ff'>(list-length / lst)</font><font style='background-color: #ff9bff'> 0)</font></TT><BR>
<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font style='background-color: #ffcdcd'>(prepend</font></TT><BR>
<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font style='background-color: #ffcd9b'>(p </font><font style='background-color: #ffcd69'>(head / lst)</font><font style='background-color: #ffcd9b'>)</font></TT><BR>
<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font style='background-color: #cdcdcd'>(map </font><font style='background-color: #9bcdcd'>(p)</font><font style='background-color: #cdcdcd'> </font><font style='background-color: #cd9bcd'>(tail / lst)</font><font style='background-color: #cdcdcd'>)</font><font style='background-color: #ffcdcd'>)</font></TT><BR>
<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font style='background-color: #cdcdff'>(vector)</font><font style='background-color: #ffcdff'>)</font>);</TT><BR>
<BR>
<TT>[<A HREF='sound.cgi?s=21000000322101010132211003210010130232100132210010133210332210000320321000321111333221000032032100003211110332233'>hear</A>] </TT><TT>(list= <font style='background-color: #cdffff'>(map </font><font style='background-color: #9bffff'>(? x / * </font><font style='background-color: #69ffff'>(x)</font><font style='background-color: #9bffff'> 2)</font><font style='background-color: #cdffff'> </font><font style='background-color: #cdcdff'>(vector 0 8 15)</font><font style='background-color: #cdffff'>)</font></TT><BR>
<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font style='background-color: #ffcdff'>(vector 0 16 30)</font>);</TT><BR>
<BR>
<TT>[<A HREF='sound.cgi?s=2100000032210101013221100321001013023210013221001013321033221000032110032100320321001333221000032110003210003203210010332233'>hear</A>] </TT><TT>(list= <font style='background-color: #cdffff'>(map </font><font style='background-color: #9bffff'>(? x / * </font><font style='background-color: #69ffff'>(x)</font><font style='background-color: #9bffff'> 2)</font><font style='background-color: #cdffff'> </font><font style='background-color: #cdcdff'>(vector 12 4 0 9)</font><font style='background-color: #cdffff'>)</font></TT><BR>
<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font style='background-color: #ffcdff'>(vector 24 8 0 18)</font>);</TT><BR>
<BR>
<TT>[<A HREF='sound.cgi?s=2100000032210101013221100321001013023210013221001013321033221000032100032100132101321113210103332210000321000032100103210103211103210100332233'>hear</A>] </TT><TT>(list= <font style='background-color: #cdffff'>(map </font><font style='background-color: #9bffff'>(? x / * </font><font style='background-color: #69ffff'>(x)</font><font style='background-color: #9bffff'> 2)</font><font style='background-color: #cdffff'> </font><font style='background-color: #cdcdff'>(vector 8 9 5 7 10)</font><font style='background-color: #cdffff'>)</font></TT><BR>
<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font style='background-color: #ffcdff'>(vector 16 18 10 14 20)</font>);</TT><BR>
<BR>
<TT>[<A HREF='sound.cgi?s=2100000032210101013221100321001013023210013221001013321033221000032101032110032100113210003211321333221000032101003211000321001103210000321103210332233'>hear</A>] </TT><TT>(list= <font style='background-color: #cdffff'>(map </font><font style='background-color: #9bffff'>(? x / * </font><font style='background-color: #69ffff'>(x)</font><font style='background-color: #9bffff'> 2)</font><font style='background-color: #cdffff'> </font><font style='background-color: #cdcdff'>(vector 10 12 19 8 3 1)</font><font style='background-color: #cdffff'>)</font></TT><BR>
<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font style='background-color: #ffcdff'>(vector 20 24 38 16 6 2)</font>);</TT><BR>
<BR>
<TT>[<A HREF='sound.cgi?s=21000000322101010132211003210010132101010332210000321013210010321003332210000321010103210101032101010332233'>hear</A>] </TT><TT>(list= <font style='background-color: #cdffff'>(map </font><font style='background-color: #9bffff'>(? x 42)</font><font style='background-color: #cdffff'> </font><font style='background-color: #cdcdff'>(vector 5 18 4)</font><font style='background-color: #cdffff'>)</font></TT><BR>
<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font style='background-color: #ffcdff'>(vector 42 42 42)</font>);</TT><BR>
<BR>
<TT>[<A HREF='sound.cgi?s=2100000032210101013221100321001013210101033221000032113210103210001321011333221000032101010321010103210101032101010332233'>hear</A>] </TT><TT>(list= <font style='background-color: #cdffff'>(map </font><font style='background-color: #9bffff'>(? x 42)</font><font style='background-color: #cdffff'> </font><font style='background-color: #cdcdff'>(vector 3 10 17 11)</font><font style='background-color: #cdffff'>)</font></TT><BR>
<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font style='background-color: #ffcdff'>(vector 42 42 42 42)</font>);</TT><BR>
<BR>
<TT>[<A HREF='sound.cgi?s=2100000032210101013221100321001013210101033221000032101321101321103210000321033322100003210101032101010321010103210101032101010332233'>hear</A>] </TT><TT>(list= <font style='background-color: #cdffff'>(map </font><font style='background-color: #9bffff'>(? x 42)</font><font style='background-color: #cdffff'> </font><font style='background-color: #cdcdff'>(vector 5 13 6 16 2)</font><font style='background-color: #cdffff'>)</font></TT><BR>
<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font style='background-color: #ffcdff'>(vector 42 42 42 42 42)</font>);</TT><BR>
<BR>
<TT>[<A HREF='sound.cgi?s=210000003221010101322110032100101321010103322100003210013213210011321110321103210103332210000321010103210101032101010321010103210101032101010332233'>hear</A>] </TT><TT>(list= <font style='background-color: #cdffff'>(map </font><font style='background-color: #9bffff'>(? x 42)</font><font style='background-color: #cdffff'> </font><font style='background-color: #cdcdff'>(vector 9 1 19 14 6 10)</font><font style='background-color: #cdffff'>)</font></TT><BR>
<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font style='background-color: #ffcdff'>(vector 42 42 42 42 42 42)</font>);</TT><BR>
<BR>
<TT>[<A HREF='sound.cgi?s=2110132101011130232110103221010110321110113322111132211000132211110130232111011332103322101011032211101030232111011332210101113221010110332211110030232111011333322111132210322111101302321110113321332211101030232111011332210000033332233'>hear</A>] </TT><TT>(define crunch /</TT><BR>
<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT><TT>&nbsp;&nbsp;lambda <font style='background-color: #cdffff'>(p lst)</font></TT><BR>
<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT><TT>&nbsp;&nbsp;&nbsp;<font style='background-color: #ffcdff'>(if </font><font style='background-color: #ff9bff'>(&gt;= </font><font style='background-color: #ff69ff'>(list-length / lst)</font><font style='background-color: #ff9bff'> 2)</font></TT><BR>
<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font style='background-color: #ffcdcd'>(p </font><font style='background-color: #ffcd9b'>(head / lst)</font><font style='background-color: #ffcdcd'> </font><font style='background-color: #cdcdcd'>(crunch </font><font style='background-color: #9bcdcd'>(p)</font><font style='background-color: #cdcdcd'> </font><font style='background-color: #cd9bcd'>(tail / lst)</font><font style='background-color: #cdcdcd'>)</font><font style='background-color: #ffcdcd'>)</font></TT><BR>
<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font style='background-color: #cdcdff'>(if </font><font style='background-color: #9bcdff'>(= </font><font style='background-color: #69cdff'>(list-length / lst)</font><font style='background-color: #9bcdff'> 1)</font></TT><BR>
<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font style='background-color: #cd9bff'>(head /</font></TT><BR>
<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font style='background-color: #cd9bff'>lst)</font></TT><BR>
<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font style='background-color: #cdcdcd'>(undefined)</font><font style='background-color: #cdcdff'>)</font><font style='background-color: #ffcdff'>)</font>);</TT><BR>
<BR>
<TT>[<A HREF='sound.cgi?s=2103221010111322101033221000032101321100321033321001132233'>hear</A>] </TT><TT>(= <font style='background-color: #cdffff'>(crunch </font><font style='background-color: #9bffff'>(+)</font><font style='background-color: #cdffff'> </font><font style='background-color: #cdcdff'>(vector 5 12 2)</font><font style='background-color: #cdffff'>)</font> 19);</TT><BR>
<BR>
<TT>[<A HREF='sound.cgi?s=21032210101113221010332210000321011321001032132100333210001032233'>hear</A>] </TT><TT>(= <font style='background-color: #cdffff'>(crunch </font><font style='background-color: #9bffff'>(+)</font><font style='background-color: #cdffff'> </font><font style='background-color: #cdcdff'>(vector 11 18 1 4)</font><font style='background-color: #cdffff'>)</font> 34);</TT><BR>
<BR>
<TT>[<A HREF='sound.cgi?s=210322101011132210103322100003211113211013210103211003210333211010032233'>hear</A>] </TT><TT>(= <font style='background-color: #cdffff'>(crunch </font><font style='background-color: #9bffff'>(+)</font><font style='background-color: #cdffff'> </font><font style='background-color: #cdcdff'>(vector 15 13 10 12 2)</font><font style='background-color: #cdffff'>)</font> 52);</TT><BR>
<BR>
<TT>[<A HREF='sound.cgi?s=21032210101113221010332210000321100321103210001321111321003210103332100000032233'>hear</A>] </TT><TT>(= <font style='background-color: #cdffff'>(crunch </font><font style='background-color: #9bffff'>(+)</font><font style='background-color: #cdffff'> </font><font style='background-color: #cdcdff'>(vector 12 6 17 15 4 10)</font><font style='background-color: #cdffff'>)</font> 64);</TT><BR>
<BR>

</BODY>
</HTML>
