<spanclass="synComment">;; P07 (**) Flatten a nested list structure.</span>
<spanclass="synComment">;; Transform a list, possibly holding lists as elements into a `flat' list by replacing each list with its elements (recursively).</span>
[<spanclass="synSpecial">(</span><spanclass="synStatement">atom</span>? <spanclass="synSpecial">(</span><spanclass="synStatement">car</span> l<spanclass="synSpecial">))</span><spanclass="synSpecial">(</span>temp <spanclass="synSpecial">(</span><spanclass="synStatement">append</span> result
<spanclass="synComment">;; P08 (**) Eliminate consecutive duplicates of list elements.</span>
<spanclass="synComment">;; If a list contains repeated elements they should be replaced with a single copy of the element. The order of the elements should not be changed.</span>
<spanclass="synComment">;; Example:</span>
<spanclass="synComment">;; * (compress '(a a a a b c c a a d e e e e))</span>
<spanclass="synSpecial">(</span>letrec <spanclass="synSpecial">((</span>temp <spanclass="synSpecial">(</span><spanclass="synStatement">lambda</span><spanclass="synSpecial">(</span>front result l<spanclass="synSpecial">)</span>
[<spanclass="synSpecial">(</span><spanclass="synStatement">eq</span>? front <spanclass="synSpecial">(</span><spanclass="synStatement">car</span> l<spanclass="synSpecial">))</span><spanclass="synSpecial">(</span>temp front
<spanclass="synSpecial">(</span><spanclass="synStatement">append</span> result <spanclass="synSpecial">(</span><spanclass="synStatement">list</span><spanclass="synSpecial">(</span><spanclass="synStatement">car</span> l<spanclass="synSpecial">)))</span>