<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="es">
	<id>https://www.glc.us.es/WIKIS/I1M2021G2/index.php?action=history&amp;feed=atom&amp;title=Relaci%C3%B3n_8_Sol</id>
	<title>Relación 8 Sol - Historial de revisiones</title>
	<link rel="self" type="application/atom+xml" href="https://www.glc.us.es/WIKIS/I1M2021G2/index.php?action=history&amp;feed=atom&amp;title=Relaci%C3%B3n_8_Sol"/>
	<link rel="alternate" type="text/html" href="https://www.glc.us.es/WIKIS/I1M2021G2/index.php?title=Relaci%C3%B3n_8_Sol&amp;action=history"/>
	<updated>2026-07-18T13:27:20Z</updated>
	<subtitle>Historial de revisiones de esta página en el wiki</subtitle>
	<generator>MediaWiki 1.36.1</generator>
	<entry>
		<id>https://www.glc.us.es/WIKIS/I1M2021G2/index.php?title=Relaci%C3%B3n_8_Sol&amp;diff=516&amp;oldid=prev</id>
		<title>Mdelamor en 08:58 8 dic 2021</title>
		<link rel="alternate" type="text/html" href="https://www.glc.us.es/WIKIS/I1M2021G2/index.php?title=Relaci%C3%B3n_8_Sol&amp;diff=516&amp;oldid=prev"/>
		<updated>2021-12-08T08:58:00Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;es&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Revisión anterior&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revisión del 08:58 8 dic 2021&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l246&quot;&gt;Línea 246:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Línea 246:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;-- ---------------------------------------------------------------------&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;-- ---------------------------------------------------------------------&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;-- &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Se redefine &lt;/del&gt;la relación &amp;#039;r&amp;#039; con &amp;#039;rpar&amp;#039; para que se aplique a pares&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;-- &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;1ª solución&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;-- Redefinir &lt;/ins&gt;la relación &amp;#039;r&amp;#039; con &amp;#039;rpar&amp;#039; para que se aplique a pares&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;relacionadosA :: (a -&amp;gt; a -&amp;gt; Bool) -&amp;gt; [a] -&amp;gt; Bool&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;relacionadosA :: (a -&amp;gt; a -&amp;gt; Bool) -&amp;gt; [a] -&amp;gt; Bool&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;relacionadosA r xs = all rpar (zip xs (tail xs))&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;relacionadosA r xs = all rpar (zip xs (tail xs))&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   where rpar (x,y) = r x y&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   where rpar (x,y) = r x y&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;-- 2ª solución. La función uncurry hace esa conversión, de función&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;-- con dos argumentos a función que recibe un par&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;relacionadosA&#039; :: (a -&gt; a -&gt; Bool) -&gt; [a] -&gt; Bool&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;relacionadosA&#039; r xs = all (uncurry r) (zip xs (tail xs))&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;-- ---------------------------------------------------------------------&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;-- ---------------------------------------------------------------------&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l260&quot;&gt;Línea 260:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Línea 266:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;-- ---------------------------------------------------------------------&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;-- ---------------------------------------------------------------------&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;-- 1ª solución&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;relacionadosP :: (a -&amp;gt; a -&amp;gt; Bool) -&amp;gt; [a] -&amp;gt; Bool&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;relacionadosP :: (a -&amp;gt; a -&amp;gt; Bool) -&amp;gt; [a] -&amp;gt; Bool&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;relacionadosP r xs = foldr rfpar True (zip xs (tail xs))&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;relacionadosP r xs = foldr rfpar True (zip xs (tail xs))&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   where rfpar (x,y) b = (r x y) &amp;amp;&amp;amp; b&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   where rfpar (x,y) b = (r x y) &amp;amp;&amp;amp; b&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;-- 2ª solución, sin usar el zip, y $ es igual que poner paréntesis hasta&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;-- el final de la línea&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;relacionadosP&#039; :: (a -&gt; a -&gt; Bool) -&gt; [a] -&gt; Bool&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;relacionadosP&#039; r xs = snd $ foldr rfpar (last xs,True) (init xs)&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;  where rfpar x (y,b) = (x,(r x y) &amp;amp;&amp;amp; b)&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;-- ---------------------------------------------------------------------&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;-- ---------------------------------------------------------------------&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;-- Ejercicio 9.3. (Basado en el ejercicio 4 del primer parcial)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;-- Ejercicio 9.3. (Basado en el ejercicio 4 del primer parcial)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;-- Una lista se dirá muy creciente si cada elemento es mayor estricto&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;-- Una lista se dirá muy creciente si cada elemento es mayor estricto&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;-- que el triple del &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;siguiente&lt;/del&gt;.  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;-- que el triple del &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;anterior&lt;/ins&gt;.  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;-- Empleando tan solo (relacionadosA p xs), define el predicado  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;-- Empleando tan solo (relacionadosA p xs), define el predicado  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;--          muyCreciente :: [Integer] -&amp;gt; Bool&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;--          muyCreciente :: [Integer] -&amp;gt; Bool&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Mdelamor</name></author>
	</entry>
	<entry>
		<id>https://www.glc.us.es/WIKIS/I1M2021G2/index.php?title=Relaci%C3%B3n_8_Sol&amp;diff=454&amp;oldid=prev</id>
		<title>Mdelamor: Protegió «Relación 8 Sol» ([Editar=Solo administradores] (indefinido) [Trasladar=Solo administradores] (indefinido))</title>
		<link rel="alternate" type="text/html" href="https://www.glc.us.es/WIKIS/I1M2021G2/index.php?title=Relaci%C3%B3n_8_Sol&amp;diff=454&amp;oldid=prev"/>
		<updated>2021-11-17T22:31:32Z</updated>

		<summary type="html">&lt;p&gt;Protegió «&lt;a href=&quot;/WIKIS/I1M2021G2/index.php/Relaci%C3%B3n_8_Sol&quot; title=&quot;Relación 8 Sol&quot;&gt;Relación 8 Sol&lt;/a&gt;» ([Editar=Solo administradores] (indefinido) [Trasladar=Solo administradores] (indefinido))&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;es&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Revisión anterior&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revisión del 22:31 17 nov 2021&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;es&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(Sin diferencias)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Mdelamor</name></author>
	</entry>
	<entry>
		<id>https://www.glc.us.es/WIKIS/I1M2021G2/index.php?title=Relaci%C3%B3n_8_Sol&amp;diff=453&amp;oldid=prev</id>
		<title>Mdelamor: Página creada con «&lt;source lang=&#039;haskell&#039;&gt;  -- I1M 2021-22: Rel_8_sol.hs -- Funciones de orden superior y definiciones por plegados. -- Departamento de Ciencias de la Computación e I.A. -- U…»</title>
		<link rel="alternate" type="text/html" href="https://www.glc.us.es/WIKIS/I1M2021G2/index.php?title=Relaci%C3%B3n_8_Sol&amp;diff=453&amp;oldid=prev"/>
		<updated>2021-11-17T22:31:23Z</updated>

		<summary type="html">&lt;p&gt;Página creada con «&amp;lt;source lang=&amp;#039;haskell&amp;#039;&amp;gt;  -- I1M 2021-22: Rel_8_sol.hs -- Funciones de orden superior y definiciones por plegados. -- Departamento de Ciencias de la Computación e I.A. -- U…»&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Página nueva&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;source lang=&amp;#039;haskell&amp;#039;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
-- I1M 2021-22: Rel_8_sol.hs&lt;br /&gt;
-- Funciones de orden superior y definiciones por plegados.&lt;br /&gt;
-- Departamento de Ciencias de la Computación e I.A.&lt;br /&gt;
-- Universidad de Sevilla&lt;br /&gt;
-- =====================================================================&lt;br /&gt;
&lt;br /&gt;
-- ---------------------------------------------------------------------&lt;br /&gt;
-- Introducción                                                       --&lt;br /&gt;
-- ---------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
-- Esta relación tiene contiene ejercicios con funciones de orden&lt;br /&gt;
-- superior y definiciones por plegado correspondientes al tema 7 &lt;br /&gt;
-- http://www.cs.us.es/~jalonso/cursos/i1m/temas/tema-7.html&lt;br /&gt;
&lt;br /&gt;
-- ---------------------------------------------------------------------&lt;br /&gt;
-- Importación de librerías auxiliares                                --&lt;br /&gt;
-- ---------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
import Test.QuickCheck&lt;br /&gt;
&lt;br /&gt;
-- ---------------------------------------------------------------------&lt;br /&gt;
-- Ejercicio 1. Definir la función&lt;br /&gt;
--    segmentos :: (a -&amp;gt; Bool) -&amp;gt; [a] -&amp;gt; [a]&lt;br /&gt;
-- tal que (segmentos p xs) es la lista de los segmentos de xs cuyos&lt;br /&gt;
-- elementos verifican la propiedad p. Por ejemplo,&lt;br /&gt;
--    segmentos even [1,2,0,4,9,6,4,5,7,2]  ==  [[2,0,4],[6,4],[2]]&lt;br /&gt;
--    segmentos odd  [1,2,0,4,9,6,4,5,7,2]  ==  [[1],[9],[5,7]]&lt;br /&gt;
-- ---------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
segmentos :: (a -&amp;gt; Bool) -&amp;gt; [a] -&amp;gt; [[a]]&lt;br /&gt;
segmentos _ [] = []&lt;br /&gt;
segmentos p (x:xs) &lt;br /&gt;
    | p x       = takeWhile p (x:xs) : segmentos p (dropWhile p xs)&lt;br /&gt;
    | otherwise = segmentos p xs&lt;br /&gt;
&lt;br /&gt;
-- ---------------------------------------------------------------------&lt;br /&gt;
-- Ejercicio 2.1. Definir, por comprensión, la función&lt;br /&gt;
--    relacionadosC :: (a -&amp;gt; a -&amp;gt; Bool) -&amp;gt; [a] -&amp;gt; Bool&lt;br /&gt;
-- tal que (relacionadosC r xs) se verifica si para todo par (x,y) de&lt;br /&gt;
-- elementos consecutivos de xs se cumple la relación r. Por ejemplo,&lt;br /&gt;
--    relacionadosC (&amp;lt;) [2,3,7,9]                ==  True&lt;br /&gt;
--    relacionadosC (&amp;lt;) [2,3,1,9]                ==  False&lt;br /&gt;
-- ---------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
relacionadosC :: (a -&amp;gt; a -&amp;gt; Bool) -&amp;gt; [a] -&amp;gt; Bool&lt;br /&gt;
relacionadosC r xs = and [r x y | (x,y) &amp;lt;- zip xs (tail xs)]&lt;br /&gt;
&lt;br /&gt;
-- ---------------------------------------------------------------------&lt;br /&gt;
-- Ejercicio 2.2. Definir, por recursión, la función&lt;br /&gt;
--    relacionadosR :: (a -&amp;gt; a -&amp;gt; Bool) -&amp;gt; [a] -&amp;gt; Bool&lt;br /&gt;
-- tal que (relacionadosR r xs) se verifica si para todo par (x,y) de&lt;br /&gt;
-- elementos consecutivos de xs se cumple la relación r. Por ejemplo,&lt;br /&gt;
--    relacionadosR (&amp;lt;) [2,3,7,9]                ==  True&lt;br /&gt;
--    relacionadosR (&amp;lt;) [2,3,1,9]                ==  False&lt;br /&gt;
-- ---------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
relacionadosR :: (a -&amp;gt; a -&amp;gt; Bool) -&amp;gt; [a] -&amp;gt; Bool&lt;br /&gt;
relacionadosR r (x:y:zs) = r x y &amp;amp;&amp;amp; relacionadosR r (y:zs)&lt;br /&gt;
relacionadosR _ _        = True&lt;br /&gt;
&lt;br /&gt;
-- ---------------------------------------------------------------------&lt;br /&gt;
-- Ejercicio 3.1. Definir la función&lt;br /&gt;
--    agrupa :: Eq a =&amp;gt; [[a]] -&amp;gt; [[a]]&lt;br /&gt;
-- tal que (agrupa xss) es la lista de las listas obtenidas agrupando&lt;br /&gt;
-- los primeros elementos, los segundos, ... Por ejemplo, &lt;br /&gt;
--    agrupa [[1..6],[7..9],[10..20]]  ==  [[1,7,10],[2,8,11],[3,9,12]]&lt;br /&gt;
--    agrupa []                        ==  []&lt;br /&gt;
-- ---------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
agrupa :: Eq a =&amp;gt; [[a]] -&amp;gt; [[a]]&lt;br /&gt;
agrupa []  = []&lt;br /&gt;
agrupa xss&lt;br /&gt;
    | [] `elem` xss = []&lt;br /&gt;
    | otherwise     = primeros xss : agrupa (restos xss)&lt;br /&gt;
    where primeros = map head&lt;br /&gt;
          restos   = map tail&lt;br /&gt;
&lt;br /&gt;
-- ---------------------------------------------------------------------&lt;br /&gt;
-- Ejercicio 3.2. Comprobar con QuickChek que la longitud de todos los&lt;br /&gt;
-- elementos de (agrupa xs) es igual a la longitud de xs.&lt;br /&gt;
-- ---------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
-- La propiedad es&lt;br /&gt;
prop_agrupa :: [[Int]] -&amp;gt; Bool&lt;br /&gt;
prop_agrupa xss =&lt;br /&gt;
    and [length xs == n | xs &amp;lt;- agrupa xss]&lt;br /&gt;
    where n = length xss&lt;br /&gt;
&lt;br /&gt;
-- La comprobación es&lt;br /&gt;
--    ghci&amp;gt; quickCheck prop_agrupa&lt;br /&gt;
--    +++ OK, passed 100 tests.&lt;br /&gt;
&lt;br /&gt;
comprueba_agrupa :: IO ()&lt;br /&gt;
comprueba_agrupa =&lt;br /&gt;
  quickCheck prop_agrupa&lt;br /&gt;
&lt;br /&gt;
-- ---------------------------------------------------------------------&lt;br /&gt;
-- Ejercicio 4.1. Definir, por recursión, la función &lt;br /&gt;
--    concatR :: [[a]] -&amp;gt; [a]&lt;br /&gt;
-- tal que (concatR xss) es la concatenación de las listas de xss. Por&lt;br /&gt;
-- ejemplo, &lt;br /&gt;
--    concatR [[1,3],[2,4,6],[1,9]]  ==  [1,3,2,4,6,1,9]&lt;br /&gt;
-- ---------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
concatR :: [[a]] -&amp;gt; [a]&lt;br /&gt;
concatR []       = []&lt;br /&gt;
concatR (xs:xss) = xs ++ concatR xss&lt;br /&gt;
&lt;br /&gt;
-- ---------------------------------------------------------------------&lt;br /&gt;
-- Ejercicio 5.1. Definir, por comprensión, la función&lt;br /&gt;
--    filtraAplicaC :: (a -&amp;gt; b) -&amp;gt; (a -&amp;gt; Bool) -&amp;gt; [a] -&amp;gt; [b]&lt;br /&gt;
-- tal que (filtraAplicaC f p xs) es la lista obtenida aplicándole a los&lt;br /&gt;
-- elementos de xs que cumplen el predicado p la función f. Por ejemplo,&lt;br /&gt;
--    filtraAplicaC (4+) (&amp;lt;3) [1..7]  =&amp;gt;  [5,6]&lt;br /&gt;
-- ---------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
filtraAplicaC :: (a -&amp;gt; b) -&amp;gt; (a -&amp;gt; Bool) -&amp;gt; [a] -&amp;gt; [b]&lt;br /&gt;
filtraAplicaC f p xs = [f x | x &amp;lt;- xs, p x]&lt;br /&gt;
&lt;br /&gt;
-- ---------------------------------------------------------------------&lt;br /&gt;
-- Ejercicio 5.2. Definir, usando map y filter, la función&lt;br /&gt;
--    filtraAplicaMF :: (a -&amp;gt; b) -&amp;gt; (a -&amp;gt; Bool) -&amp;gt; [a] -&amp;gt; [b]&lt;br /&gt;
-- tal que (filtraAplicaMF f p xs) es la lista obtenida aplicándole a los&lt;br /&gt;
-- elementos de xs que cumplen el predicado p la función f. Por ejemplo,&lt;br /&gt;
--    filtraAplicaMF (4+) (&amp;lt;3) [1..7]  =&amp;gt;  [5,6]&lt;br /&gt;
-- ---------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
filtraAplicaMF :: (a -&amp;gt; b) -&amp;gt; (a -&amp;gt; Bool) -&amp;gt; [a] -&amp;gt; [b]&lt;br /&gt;
filtraAplicaMF f p xs = map f (filter p xs)&lt;br /&gt;
&lt;br /&gt;
-- ---------------------------------------------------------------------&lt;br /&gt;
-- Ejercicio 5.3. Definir, por recursión, la función&lt;br /&gt;
--    filtraAplicaR :: (a -&amp;gt; b) -&amp;gt; (a -&amp;gt; Bool) -&amp;gt; [a] -&amp;gt; [b]&lt;br /&gt;
-- tal que (filtraAplicaR f p xs) es la lista obtenida aplicándole a los&lt;br /&gt;
-- elementos de xs que cumplen el predicado p la función f. Por ejemplo,&lt;br /&gt;
--    filtraAplicaR (4+) (&amp;lt;3) [1..7]  =&amp;gt;  [5,6]&lt;br /&gt;
-- ---------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
filtraAplicaR :: (a -&amp;gt; b) -&amp;gt; (a -&amp;gt; Bool) -&amp;gt; [a] -&amp;gt; [b]&lt;br /&gt;
filtraAplicaR _ _ [] = []&lt;br /&gt;
filtraAplicaR f p (x:xs) | p x       = f x : filtraAplicaR f p xs&lt;br /&gt;
                         | otherwise = filtraAplicaR f p xs&lt;br /&gt;
&lt;br /&gt;
-- ---------------------------------------------------------------------&lt;br /&gt;
-- Ejercicio 6.1. Definir, mediante recursión, la función&lt;br /&gt;
--    maximumR :: Ord a =&amp;gt; [a] -&amp;gt; a&lt;br /&gt;
-- tal que (maximumR xs) es el máximo de la lista xs. Por ejemplo,&lt;br /&gt;
--    maximumR [3,7,2,5]                  ==  7&lt;br /&gt;
--    maximumR [&amp;quot;todo&amp;quot;,&amp;quot;es&amp;quot;,&amp;quot;falso&amp;quot;]      ==  &amp;quot;todo&amp;quot;&lt;br /&gt;
--    maximumR [&amp;quot;menos&amp;quot;,&amp;quot;alguna&amp;quot;,&amp;quot;cosa&amp;quot;]  ==  &amp;quot;menos&amp;quot;&lt;br /&gt;
-- &lt;br /&gt;
-- Nota: La función maximumR es equivalente a la predefinida maximum.&lt;br /&gt;
-- ---------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
maximumR :: Ord a =&amp;gt; [a] -&amp;gt; a&lt;br /&gt;
maximumR [x]      = x&lt;br /&gt;
maximumR (x:y:ys) = max x (maximumR (y:ys))&lt;br /&gt;
maximumR _        = error &amp;quot;Imposible&amp;quot;&lt;br /&gt;
&lt;br /&gt;
-- ---------------------------------------------------------------------&lt;br /&gt;
-- Ejercicio 6.2. La función de plegado foldr1 está definida por &lt;br /&gt;
--    foldr1 :: (a -&amp;gt; a -&amp;gt; a) -&amp;gt; [a] -&amp;gt; a&lt;br /&gt;
--    foldr1 _ [x]    =  x&lt;br /&gt;
--    foldr1 f (x:xs) =  f x (foldr1 f xs)&lt;br /&gt;
-- &lt;br /&gt;
-- Definir, mediante plegado con foldr1, la función&lt;br /&gt;
--    maximumP :: Ord a =&amp;gt; [a] -&amp;gt; a&lt;br /&gt;
-- tal que (maximumR xs) es el máximo de la lista xs. Por ejemplo,&lt;br /&gt;
--    maximumP [3,7,2,5]                  ==  7&lt;br /&gt;
--    maximumP [&amp;quot;todo&amp;quot;,&amp;quot;es&amp;quot;,&amp;quot;falso&amp;quot;]      ==  &amp;quot;todo&amp;quot;&lt;br /&gt;
--    maximumP [&amp;quot;menos&amp;quot;,&amp;quot;alguna&amp;quot;,&amp;quot;cosa&amp;quot;]  ==  &amp;quot;menos&amp;quot;&lt;br /&gt;
-- &lt;br /&gt;
-- Nota: La función maximumP es equivalente a la predefinida maximum.&lt;br /&gt;
-- ---------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
maximumP :: Ord a =&amp;gt; [a] -&amp;gt; a&lt;br /&gt;
maximumP = foldr1 max&lt;br /&gt;
&lt;br /&gt;
-- ---------------------------------------------------------------------&lt;br /&gt;
-- Ejercicio 7.1. Definir, usando foldr, la función &lt;br /&gt;
--    concatP :: [[a]] -&amp;gt; [a]&lt;br /&gt;
-- tal que (concatP xss) es la concatenación de las listas de xss. Por&lt;br /&gt;
-- ejemplo, &lt;br /&gt;
--    concatP [[1,3],[2,4,6],[1,9]]  ==  [1,3,2,4,6,1,9]&lt;br /&gt;
-- ---------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
concatP :: [[a]] -&amp;gt; [a]&lt;br /&gt;
concatP = foldr (++) []&lt;br /&gt;
&lt;br /&gt;
-- ---------------------------------------------------------------------&lt;br /&gt;
-- Ejercicio 7.2. Comprobar con QuickCheck que la funciones concatR,&lt;br /&gt;
-- concatP y concat son equivalentes.&lt;br /&gt;
-- ---------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
-- La propiedad es&lt;br /&gt;
prop_concat :: [[Int]] -&amp;gt; Bool&lt;br /&gt;
prop_concat xss =&lt;br /&gt;
  concatR xss == ys &amp;amp;&amp;amp; concatP xss == ys&lt;br /&gt;
  where ys = concat xss&lt;br /&gt;
&lt;br /&gt;
-- La comprobación es&lt;br /&gt;
--    ghci&amp;gt; quickCheck prop_concat&lt;br /&gt;
--    +++ OK, passed 100 tests.&lt;br /&gt;
&lt;br /&gt;
-- ---------------------------------------------------------------------&lt;br /&gt;
-- Ejercicio 7.3. Comprobar con QuickCheck que la longitud de &lt;br /&gt;
-- (concatP xss) es la suma de las longitudes de los elementos de xss.&lt;br /&gt;
-- ---------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
-- La propiedad es&lt;br /&gt;
prop_longConcat :: [[Int]] -&amp;gt; Bool&lt;br /&gt;
prop_longConcat xss =&lt;br /&gt;
    length (concatP xss) == sum [length xs | xs &amp;lt;- xss]&lt;br /&gt;
&lt;br /&gt;
-- La comprobación es&lt;br /&gt;
--    ghci&amp;gt; quickCheck prop_longConcat&lt;br /&gt;
--    +++ OK, passed 100 tests.&lt;br /&gt;
&lt;br /&gt;
-- ---------------------------------------------------------------------&lt;br /&gt;
-- Ejercicio 8. Definir, por plegado, la función&lt;br /&gt;
--    filtraAplicaP :: (a -&amp;gt; b) -&amp;gt; (a -&amp;gt; Bool) -&amp;gt; [a] -&amp;gt; [b]&lt;br /&gt;
-- tal que (filtraAplicaP f p xs) es la lista obtenida aplicándole a los&lt;br /&gt;
-- elementos de xs que cumplen el predicado p la función f. Por ejemplo,&lt;br /&gt;
--    filtraAplicaP (4+) (&amp;lt;3) [1..7]  =&amp;gt;  [5,6]&lt;br /&gt;
-- ---------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
filtraAplicaP :: (a -&amp;gt; b) -&amp;gt; (a -&amp;gt; Bool) -&amp;gt; [a] -&amp;gt; [b]&lt;br /&gt;
filtraAplicaP f p = foldr g []&lt;br /&gt;
    where g x y | p x       = f x : y&lt;br /&gt;
                | otherwise = y&lt;br /&gt;
&lt;br /&gt;
-- La definición por plegado usando lambda es&lt;br /&gt;
filtraAplicaP2 :: (a -&amp;gt; b) -&amp;gt; (a -&amp;gt; Bool) -&amp;gt; [a] -&amp;gt; [b]&lt;br /&gt;
filtraAplicaP2 f p = &lt;br /&gt;
    foldr (\x y -&amp;gt; if p x then f x : y else y) []&lt;br /&gt;
&lt;br /&gt;
-- ---------------------------------------------------------------------&lt;br /&gt;
-- Ejercicio 9.1. Definir, con la función all, la función&lt;br /&gt;
--    relacionadosA :: (a -&amp;gt; a -&amp;gt; Bool) -&amp;gt; [a] -&amp;gt; Bool&lt;br /&gt;
-- tal que (relacionadosA r xs) se verifica si para todo par (x,y) de&lt;br /&gt;
-- elementos consecutivos de xs se cumple la relación r. Por ejemplo,&lt;br /&gt;
--    relacionadosA (&amp;lt;) [2,3,7,9]                ==  True&lt;br /&gt;
--    relacionadosA (&amp;lt;) [2,3,1,9]                ==  False&lt;br /&gt;
-- ---------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
-- Se redefine la relación &amp;#039;r&amp;#039; con &amp;#039;rpar&amp;#039; para que se aplique a pares&lt;br /&gt;
relacionadosA :: (a -&amp;gt; a -&amp;gt; Bool) -&amp;gt; [a] -&amp;gt; Bool&lt;br /&gt;
relacionadosA r xs = all rpar (zip xs (tail xs))&lt;br /&gt;
  where rpar (x,y) = r x y&lt;br /&gt;
&lt;br /&gt;
-- ---------------------------------------------------------------------&lt;br /&gt;
-- Ejercicio 9.2. Definir, con la función foldr, la función&lt;br /&gt;
--    relacionadosP :: (a -&amp;gt; a -&amp;gt; Bool) -&amp;gt; [a] -&amp;gt; Bool&lt;br /&gt;
-- tal que (relacionadosP r xs) se verifica si para todo par (x,y) de&lt;br /&gt;
-- elementos consecutivos de xs se cumple la relación r. Por ejemplo,&lt;br /&gt;
--    relacionadosP (&amp;lt;) [2,3,7,9]                ==  True&lt;br /&gt;
--    relacionadosP (&amp;lt;) [2,3,1,9]                ==  False&lt;br /&gt;
-- ---------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
relacionadosP :: (a -&amp;gt; a -&amp;gt; Bool) -&amp;gt; [a] -&amp;gt; Bool&lt;br /&gt;
relacionadosP r xs = foldr rfpar True (zip xs (tail xs))&lt;br /&gt;
  where rfpar (x,y) b = (r x y) &amp;amp;&amp;amp; b&lt;br /&gt;
&lt;br /&gt;
-- ---------------------------------------------------------------------&lt;br /&gt;
-- Ejercicio 9.3. (Basado en el ejercicio 4 del primer parcial)&lt;br /&gt;
-- Una lista se dirá muy creciente si cada elemento es mayor estricto&lt;br /&gt;
-- que el triple del siguiente. &lt;br /&gt;
-- Empleando tan solo (relacionadosA p xs), define el predicado &lt;br /&gt;
--          muyCreciente :: [Integer] -&amp;gt; Bool&lt;br /&gt;
-- tal que (muyCreciente xs) se verifica si xs es muy creciente. Por&lt;br /&gt;
-- ejemplo:&lt;br /&gt;
-- muyCreciente [1,5,23,115]  == True&lt;br /&gt;
-- muyCreciente [1,2,7,14]    == False&lt;br /&gt;
-- muyCreciente [7]           == True&lt;br /&gt;
-- muyCreciente []            == True&lt;br /&gt;
-- ---------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
muyCreciente :: [Integer] -&amp;gt; Bool&lt;br /&gt;
muyCreciente xs = relacionadosA relMuyCreciente xs&lt;br /&gt;
  where relMuyCreciente a b = b &amp;gt; a*3&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mdelamor</name></author>
	</entry>
</feed>