<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Sembrando Realidades &#187; Lisp</title>
	<atom:link href="http://blog.bauna.com.ar/index.php/category/tecno/lisp/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.bauna.com.ar</link>
	<description>Un viaje a inciertos destinos</description>
	<lastBuildDate>Fri, 28 May 2010 18:30:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Aprendiendo Lisp</title>
		<link>http://blog.bauna.com.ar/index.php/2009/02/aprendiendo-lisp/</link>
		<comments>http://blog.bauna.com.ar/index.php/2009/02/aprendiendo-lisp/#comments</comments>
		<pubDate>Fri, 13 Feb 2009 16:26:56 +0000</pubDate>
		<dc:creator>bauna</dc:creator>
				<category><![CDATA[Lisp]]></category>

		<guid isPermaLink="false">http://blog.bauna.com.ar/?p=59</guid>
		<description><![CDATA[Ya que  por todos lados dicen que para ser un groso programador hay que saber Lisp con mi amigo Cucu nos pusimos a aprenderlo. El primer reto fue implementar RLE (Run Lentgth Encoding), o sea dada una lista rle '(1 1 1 2 2 3) = ((1 3) (2 2) 3) A mi no gustó [...]]]></description>
			<content:encoded><![CDATA[<p>Ya que  por todos lados dicen que para ser un groso programador hay que saber Lisp con mi amigo Cucu nos pusimos a aprenderlo.</p>
<p>El primer reto fue implementar RLE (Run Lentgth Encoding), o sea dada una lista</p>
<pre>rle '(1 1 1 2 2 3) = ((1 3) (2 2) 3)</pre>
<p>A mi no gustó que Cucu haya definido el tipo de dato es distinto dependiendo de si hay o no repeticiones pero no iba a discutir un detalle tan nimio.<br />
Y sin más acá les dejo mi solución:</p>
<pre>(defun make-elem (c n)
  (cond ((eq 1 n) (list c))
    (t (list (list c n))))
  )

(defun acum (c n r)
  (cond ((null r) (make-elem c n))
    ((eq c (first r)) (acum c (+ 1 n) (rest r)))
    (t (append (make-elem c n) (rle r))))
  )

(defun rle (l)
  (cond ((null l) nil)
      (t (acum (first l) 1 (rest l))))
)</pre>
<p>PD: Mi solución es más elegante que de Cucu, espero que se anime a postear la suya o al menos que pique en el amor propio para mejorarla!!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.bauna.com.ar/index.php/2009/02/aprendiendo-lisp/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

