<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Pfds Scala on LARGE DATA BANK</title>
    <link>https://largedatabank.com/categories/pfds-scala/</link>
    <description>Recent content in Pfds Scala on LARGE DATA BANK</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Tue, 04 Dec 2012 18:48:00 -0400</lastBuildDate>
    <atom:link href="https://largedatabank.com/categories/pfds-scala/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Exercises from PFDS Section 2.2</title>
      <link>https://largedatabank.com/posts/2012-12-04-pfds-section-2-dot-2-exercises/</link>
      <pubDate>Tue, 04 Dec 2012 18:48:00 -0400</pubDate>
      <guid>https://largedatabank.com/posts/2012-12-04-pfds-section-2-dot-2-exercises/</guid>
      <description>&lt;p&gt;Section 2.2&amp;rsquo;s exercises define some optimizations to the section&amp;rsquo;s unbalanced&#xA;tree set implementation.&lt;/p&gt;&#xA;&lt;h2 id=&#34;exercise-22&#34;&gt;Exercise 2.2&lt;/h2&gt;&#xA;&lt;p&gt;The implementation of &lt;code&gt;member&lt;/code&gt; that Okasaki gives for binary search trees in&#xA;section 2.2 performs &lt;code&gt;2d&lt;/code&gt; comparisons for a tree of depth &lt;code&gt;d&lt;/code&gt; in the worst&#xA;case, when searching for a number that is the farthest to the right on the&#xA;tree, and when the right path in the tree is of depth &lt;code&gt;d&lt;/code&gt; itself. This is&#xA;because every call of &lt;code&gt;member&lt;/code&gt; checks whether &lt;code&gt;x &amp;lt; y&lt;/code&gt; and, if not, whether &lt;code&gt;y &amp;lt; x&lt;/code&gt;. This strategy allows immediate detection of the case in which the value&#xA;being searched for is contained in the current node, permitting short-circuit&#xA;cases like where the searched-for value is in the root node, at the cost of&#xA;requiring double the comparisons when traversing rightward.&lt;/p&gt;</description>
    </item>
    <item>
      <title>PFDS Section 2.2</title>
      <link>https://largedatabank.com/posts/2012-05-01-pfds-section-2-dot-2/</link>
      <pubDate>Tue, 01 May 2012 16:33:00 -0400</pubDate>
      <guid>https://largedatabank.com/posts/2012-05-01-pfds-section-2-dot-2/</guid>
      <description>&lt;p&gt;Section 2.2 presents immutable sets implemented with unbalanced binary search&#xA;trees, a slightly more complex example of immutable data sharing than the list&#xA;example in &lt;a href=&#34;%7B%7Broot_url%7D%7D/blog/2012/01/27/chapter-1-dot-1/&#34;&gt;Section 2.1&lt;/a&gt;. My&#xA;first challenge was to reimplement Okasaki&amp;rsquo;s base implementation of unbalanced&#xA;binary search tree sets using idiomatic Scala. I had to learn a fair amount&#xA;more about Scala&amp;rsquo;s type system to be able to write such an implementation, so I&#xA;figured I&amp;rsquo;d write up some of the things I learned about Scala in the process as&#xA;well as the implementation.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Abstract Generic Collections: PFDS Section 2.1 Redux</title>
      <link>https://largedatabank.com/posts/2012-01-31-abstract-generic-collections-section-2-dot-1-redux/</link>
      <pubDate>Tue, 31 Jan 2012 00:34:00 -0400</pubDate>
      <guid>https://largedatabank.com/posts/2012-01-31-abstract-generic-collections-section-2-dot-1-redux/</guid>
      <description>&lt;p&gt;At the end of my last post, I mentioned that I ended up reusing Scala&amp;rsquo;s build-in&#xA;List collection to implement the exercises instead of writing a generic abstract&#xA;Stack and sample implementations of those. Since then, I&amp;rsquo;ve spent some time&#xA;learning about how to implement generic collections in Scala. I came up with&#xA;a Stack trait, &lt;em&gt;a la&lt;/em&gt; Okasaki&amp;rsquo;s Stack signature, and three implementations: the&#xA;first two are straightforward translations of the SML structures given in the&#xA;book, and the third is a more Scala-idiomatic implementation.&lt;/p&gt;</description>
    </item>
    <item>
      <title>PFDS Section 2.1</title>
      <link>https://largedatabank.com/posts/2012-01-27-chapter-1-dot-1/</link>
      <pubDate>Fri, 27 Jan 2012 22:09:00 -0400</pubDate>
      <guid>https://largedatabank.com/posts/2012-01-27-chapter-1-dot-1/</guid>
      <description>&lt;p&gt;This is the inaugural post of the PFDS series.&lt;/p&gt;&#xA;&lt;p&gt;Section 2.1 discusses the ramifications of implementing lists and stacks in a&#xA;functional and immutable manner. Using the operation of &lt;strong&gt;list catenation&lt;/strong&gt;&#xA;as a motivator, Okasaki introduces the idea of data sharing. We see that to&#xA;catenate two lists, we can share the second list, which doesn&amp;rsquo;t get modified,&#xA;but must copy all of the nodes in the first list just to modify the last one.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Notes on Purely Functional Data Structures</title>
      <link>https://largedatabank.com/posts/2012-01-03-notes-on-purely-functional-data-structures/</link>
      <pubDate>Tue, 03 Jan 2012 01:24:00 -0400</pubDate>
      <guid>https://largedatabank.com/posts/2012-01-03-notes-on-purely-functional-data-structures/</guid>
      <description>&lt;p&gt;I heard a lot of good things about Mike Okasaki&amp;rsquo;s &lt;a href=&#34;http://www.amazon.com/gp/product/0521663504/ref=as_li_qf_sp_asin_tl?ie=UTF8&amp;amp;tag=jordanlewisor-20&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=0521663504&#34;&gt;Purely Functional Data Structures&lt;/a&gt; at UChicago, but didn&amp;rsquo;t ever take the time to check it out. Lately I&amp;rsquo;ve missed the heady joy of reading and writing code in a strongly typed functional programming language like Standard ML, so when one of my coworkers at Knewton mentioned he was going to read the book I decided to get a copy for myself.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
