<?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>Gary Boone, PhD &#187; Scala</title>
	<atom:link href="http://garyboone.com/tag/scala/feed/" rel="self" type="application/rss+xml" />
	<link>http://garyboone.com</link>
	<description>Clippings, code snippets, and other searchable web notes</description>
	<lastBuildDate>Mon, 21 Jun 2010 20:42:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>min and sum one-liners</title>
		<link>http://garyboone.com/2009/08/min-and-sum-one-liners/</link>
		<comments>http://garyboone.com/2009/08/min-and-sum-one-liners/#comments</comments>
		<pubDate>Fri, 21 Aug 2009 05:45:05 +0000</pubDate>
		<dc:creator>gary</dc:creator>
				<category><![CDATA[Scala]]></category>

		<guid isPermaLink="false">http://garyboone.com/2009/08/min-and-sum-one-liners/</guid>
		<description><![CDATA[
// Sum the values in a list
val sum = (0.0 /: list){ _ + _ }
// What it says: it's an abbreviated form of
// list.leftFold(0.0) { (s,i) =&#62; s + i }

// Find the minimum value in a list
val minValue = list.reduceLeft( _ min _ )
// What it says: Note that it's reduce, not fold. [...]]]></description>
			<content:encoded><![CDATA[<pre class="brush: scala;">
// Sum the values in a list
val sum = (0.0 /: list){ _ + _ }
// What it says: it's an abbreviated form of
// list.leftFold(0.0) { (s,i) =&gt; s + i }

// Find the minimum value in a list
val minValue = list.reduceLeft( _ min _ )
// What it says: Note that it's reduce, not fold. It applies the
// min function to the series of results obtained by applying
// the function from the left. 

// Note the difference between fold and reduce: fold takes an
// initial value, while reduce does not.
</pre>
]]></content:encoded>
			<wfw:commentRss>http://garyboone.com/2009/08/min-and-sum-one-liners/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

