<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
xmlns:rawvoice="http://www.rawvoice.com/rawvoiceRssModule/"
	>
<channel>
	<title>Comments on: This is your brain; this is your brain on OCaml</title>
	<atom:link href="http://enfranchisedmind.com/blog/posts/this-is-your-brain-this-is-your-brain-on-ocaml/feed/" rel="self" type="application/rss+xml" />
	<link>http://enfranchisedmind.com/blog/posts/this-is-your-brain-this-is-your-brain-on-ocaml/</link>
	<description>programming, politics, &#38; other religious issues</description>
	<lastBuildDate>Wed, 08 Feb 2012 14:16:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: Robert Fischer</title>
		<link>http://enfranchisedmind.com/blog/posts/this-is-your-brain-this-is-your-brain-on-ocaml/#comment-37817</link>
		<dc:creator>Robert Fischer</dc:creator>
		<pubDate>Sun, 22 Aug 2010 23:21:16 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/?p=39#comment-37817</guid>
		<description>Yeah, shifting to use Strings as the basis instead of ints as the basis is a lot smarter.</description>
		<content:encoded><![CDATA[<p>Yeah, shifting to use Strings as the basis instead of ints as the basis is a lot smarter.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Przemek</title>
		<link>http://enfranchisedmind.com/blog/posts/this-is-your-brain-this-is-your-brain-on-ocaml/#comment-37816</link>
		<dc:creator>Przemek</dc:creator>
		<pubDate>Sun, 22 Aug 2010 17:23:48 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/?p=39#comment-37816</guid>
		<description>1) startValue &gt; endValue is not error, it is convenient way to express empty set, in that case it doesnt break anything - you just get empty array of Strings
2) do you really want complexity o((endValue-startValue)*usedValues.length)  in production code?
3) Good,  fast and &quot;in java way&quot; code (my first try):
&lt;code&gt;
public static String[] findAvialable(int startValue, int endValue, String[] usedValues) {
describe empty sets!
	TreeSet allUsed = new TreeSet(Arrays.asList(usedValues));
	ArrayList results = new ArrayList();
	for (int i = startValue; i &lt;= endValue; i++ ){
		String s = &quot;&quot;+i;
		if ( !allUsed.contains(s)){
			results.add(s);
		}
	}
	return results.toArray(new String[results.size()]);
}
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>1) startValue &gt; endValue is not error, it is convenient way to express empty set, in that case it doesnt break anything &#8211; you just get empty array of Strings<br />
2) do you really want complexity o((endValue-startValue)*usedValues.length)  in production code?<br />
3) Good,  fast and &#8220;in java way&#8221; code (my first try):<br />
<code><br />
public static String[] findAvialable(int startValue, int endValue, String[] usedValues) {<br />
describe empty sets!<br />
	TreeSet allUsed = new TreeSet(Arrays.asList(usedValues));<br />
	ArrayList results = new ArrayList();<br />
	for (int i = startValue; i &lt;= endValue; i++ ){<br />
		String s = &quot;&quot;+i;<br />
		if ( !allUsed.contains(s)){<br />
			results.add(s);<br />
		}<br />
	}<br />
	return results.toArray(new String[results.size()]);<br />
}<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: The Cheap Sitcom Clip Scene Blog Post &#124; Enfranchised Mind</title>
		<link>http://enfranchisedmind.com/blog/posts/this-is-your-brain-this-is-your-brain-on-ocaml/#comment-33556</link>
		<dc:creator>The Cheap Sitcom Clip Scene Blog Post &#124; Enfranchised Mind</dc:creator>
		<pubDate>Tue, 15 Jul 2008 04:58:39 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/?p=39#comment-33556</guid>
		<description>[...] &#8220;&#8230;since I was writing JUnit tests anyways, I figured I would do a bit of clean-up. What I didn’t realize is that Ocaml has warped me, and my concept of “cleanup” is very different than everyone else’s.&#8221; (This Is Your Brain; This Is Your Brain on OCaml) [...]</description>
		<content:encoded><![CDATA[<p>[...] &#8220;&#8230;since I was writing JUnit tests anyways, I figured I would do a bit of clean-up. What I didn’t realize is that Ocaml has warped me, and my concept of “cleanup” is very different than everyone else’s.&#8221; (This Is Your Brain; This Is Your Brain on OCaml) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Fischer</title>
		<link>http://enfranchisedmind.com/blog/posts/this-is-your-brain-this-is-your-brain-on-ocaml/#comment-25</link>
		<dc:creator>Robert Fischer</dc:creator>
		<pubDate>Fri, 16 Dec 2005 19:37:07 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/?p=39#comment-25</guid>
		<description>Good call -- I actually did that when I went back to my code after lunch.  Particularly considering that the number of &quot;used&quot; elements is known to be small in this implementation, that&#039;s a much better way to go.  There is a type mismatch between the used set and the available list, but the resolution is left as an exercise for the reader.

I also changed the List to a TreeSet, which retains the sorting I need but substantially improves performance in the removeAll call.  I had to create a singleton Comparator that compared on length first, and then on content, but it&#039;s still pretty nifty.

The other change I made was to change &lt;code&gt;new Integer(Integer.parseInt(object.toString()))&lt;/code&gt; to just &lt;code&gt;new Integer(object.toString())&lt;/code&gt;.</description>
		<content:encoded><![CDATA[<p>Good call &#8212; I actually did that when I went back to my code after lunch.  Particularly considering that the number of &#8220;used&#8221; elements is known to be small in this implementation, that&#8217;s a much better way to go.  There is a type mismatch between the used set and the available list, but the resolution is left as an exercise for the reader.</p>
<p>I also changed the List to a TreeSet, which retains the sorting I need but substantially improves performance in the removeAll call.  I had to create a singleton Comparator that compared on length first, and then on content, but it&#8217;s still pretty nifty.</p>
<p>The other change I made was to change <code>new Integer(Integer.parseInt(object.toString()))</code> to just <code>new Integer(object.toString())</code>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TheHawk</title>
		<link>http://enfranchisedmind.com/blog/posts/this-is-your-brain-this-is-your-brain-on-ocaml/#comment-24</link>
		<dc:creator>TheHawk</dc:creator>
		<pubDate>Fri, 16 Dec 2005 17:56:32 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/?p=39#comment-24</guid>
		<description>You are a sick man... but instead of the for loop you could have created a List of Ints between Start Value and End Value (which is more natural with the program) and then RemoveALL the elements in the used set.</description>
		<content:encoded><![CDATA[<p>You are a sick man&#8230; but instead of the for loop you could have created a List of Ints between Start Value and End Value (which is more natural with the program) and then RemoveALL the elements in the used set.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

