<?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/"
		>
<channel>
	<title>Comments on: Why Haskell is a joy to learn</title>
	<atom:link href="http://www.webframp.com/2009/04/15/why-haskell-is-a-joy-to-learn/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.webframp.com/2009/04/15/why-haskell-is-a-joy-to-learn/</link>
	<description>passing thoughts on the web</description>
	<lastBuildDate>Sat, 03 Oct 2009 05:43:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: dannyo152</title>
		<link>http://www.webframp.com/2009/04/15/why-haskell-is-a-joy-to-learn/comment-page-1/#comment-327</link>
		<dc:creator>dannyo152</dc:creator>
		<pubDate>Fri, 24 Apr 2009 04:09:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.webframp.com/?p=119#comment-327</guid>
		<description>Oh dear, not only did my indents not make it through, the last line of the function disappeared.

The last line of the function is:

sum [ i &#124; i &lt;- [ 1 .. lim - 1 ], iOkay i ]</description>
		<content:encoded><![CDATA[<p>Oh dear, not only did my indents not make it through, the last line of the function disappeared.</p>
<p>The last line of the function is:</p>
<p>sum [ i | i &lt;- [ 1 .. lim - 1 ], iOkay i ]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dannyo152</title>
		<link>http://www.webframp.com/2009/04/15/why-haskell-is-a-joy-to-learn/comment-page-1/#comment-326</link>
		<dc:creator>dannyo152</dc:creator>
		<pubDate>Fri, 24 Apr 2009 04:05:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.webframp.com/?p=119#comment-326</guid>
		<description>I think one of swell things about Haskell is if you can&#039;t find the wheel, it&#039;s not hard to reinvent one.

So, just for giggles, let&#039;s take the problem and make the limit and primes and their count variable:

sumPrimeMultsBeforeLimit :: [Integer] -&gt; Integer -&gt; Integer
sumPrimeMultsBeforeLimit primeList lim = 
 let
  --a function that tests a number and base
  modTestGood base val = mod val base == 0
  --we&#039;ll make a list of partial functions from the primes
  --we&#039;ll also say if the primes are an empty list, all the 
  -- numbers are good and we get the sum of the numbers from 1 to n-1
  -- the type of testList is [Integer-&gt;Bool]
  testList = if primeList == [] 
                then [(\ i -&gt; True )]
                else map (\ k -&gt; modTestGood k ) primeList
  -- we use or on a List of True and False results
  -- created by mapping a function that completes
  -- modTestGood
  iOkay i = or ( map (\ f -&gt; f i ) testList )
 in
   --sum the list comprehension use the iOkay filter
   sum [ i &#124; i  sumPrimeMultsBeforeLimit [3,5] 1000
233168
*Vendor&gt; seansFn
233168

Before I click &quot;Post&quot; a prayer to the CSS gods for a sensible layout.</description>
		<content:encoded><![CDATA[<p>I think one of swell things about Haskell is if you can&#8217;t find the wheel, it&#8217;s not hard to reinvent one.</p>
<p>So, just for giggles, let&#8217;s take the problem and make the limit and primes and their count variable:</p>
<p>sumPrimeMultsBeforeLimit :: [Integer] -&gt; Integer -&gt; Integer<br />
sumPrimeMultsBeforeLimit primeList lim =<br />
 let<br />
  &#8211;a function that tests a number and base<br />
  modTestGood base val = mod val base == 0<br />
  &#8211;we&#8217;ll make a list of partial functions from the primes<br />
  &#8211;we&#8217;ll also say if the primes are an empty list, all the<br />
  &#8212; numbers are good and we get the sum of the numbers from 1 to n-1<br />
  &#8212; the type of testList is [Integer-&gt;Bool]<br />
  testList = if primeList == []<br />
                then [(\ i -&gt; True )]<br />
                else map (\ k -&gt; modTestGood k ) primeList<br />
  &#8212; we use or on a List of True and False results<br />
  &#8212; created by mapping a function that completes<br />
  &#8212; modTestGood<br />
  iOkay i = or ( map (\ f -&gt; f i ) testList )<br />
 in<br />
   &#8211;sum the list comprehension use the iOkay filter<br />
   sum [ i | i  sumPrimeMultsBeforeLimit [3,5] 1000<br />
233168<br />
*Vendor&gt; seansFn<br />
233168</p>
<p>Before I click &#8220;Post&#8221; a prayer to the CSS gods for a sensible layout.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sean</title>
		<link>http://www.webframp.com/2009/04/15/why-haskell-is-a-joy-to-learn/comment-page-1/#comment-325</link>
		<dc:creator>sean</dc:creator>
		<pubDate>Fri, 17 Apr 2009 17:38:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.webframp.com/?p=119#comment-325</guid>
		<description>I love all the discussion actually. I knew my solution was far from ideal when I posted it, especially given that I have a knowledge of the haskell Prelude that tends toward 0. So it&#039;s been wonderfully informative to see the ongoing comments.</description>
		<content:encoded><![CDATA[<p>I love all the discussion actually. I knew my solution was far from ideal when I posted it, especially given that I have a knowledge of the haskell Prelude that tends toward 0. So it&#8217;s been wonderfully informative to see the ongoing comments.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jade NB</title>
		<link>http://www.webframp.com/2009/04/15/why-haskell-is-a-joy-to-learn/comment-page-1/#comment-324</link>
		<dc:creator>Jade NB</dc:creator>
		<pubDate>Fri, 17 Apr 2009 17:04:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.webframp.com/?p=119#comment-324</guid>
		<description>I think that you&#039;ve just shown that, while Haskell is a joy to learn, it&#039;s not always a joy to show others your Haskell.  Go for something incomprehensible first, so that it takes a while to come up with alternate idioms for it.  :-)</description>
		<content:encoded><![CDATA[<p>I think that you&#8217;ve just shown that, while Haskell is a joy to learn, it&#8217;s not always a joy to show others your Haskell.  Go for something incomprehensible first, so that it takes a while to come up with alternate idioms for it.  <img src='http://www.webframp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: josh</title>
		<link>http://www.webframp.com/2009/04/15/why-haskell-is-a-joy-to-learn/comment-page-1/#comment-323</link>
		<dc:creator>josh</dc:creator>
		<pubDate>Fri, 17 Apr 2009 16:38:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.webframp.com/?p=119#comment-323</guid>
		<description>What&#039;s unclear about (a `isMultOf`) `any` [3,5]?  It&#039;s practically english.</description>
		<content:encoded><![CDATA[<p>What&#8217;s unclear about (a `isMultOf`) `any` [3,5]?  It&#8217;s practically english.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vasyl Pasternak</title>
		<link>http://www.webframp.com/2009/04/15/why-haskell-is-a-joy-to-learn/comment-page-1/#comment-322</link>
		<dc:creator>Vasyl Pasternak</dc:creator>
		<pubDate>Fri, 17 Apr 2009 13:27:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.webframp.com/?p=119#comment-322</guid>
		<description>Another way to do it:

sum_mult_3 = sum [3,6..1000]

sum_mult_5 = sum [5,10..1000]

sum_mult_15 = sum [15,30..1000]

result = sum_mult_3 + sum_mult_5 - sum_mult_15

all these lines could be reduced to:

sum $ map sum [[3,6..1000],[5,10..1000],[(-15),(-30)..(-1000)]]

but this is less understandable :)</description>
		<content:encoded><![CDATA[<p>Another way to do it:</p>
<p>sum_mult_3 = sum [3,6..1000]</p>
<p>sum_mult_5 = sum [5,10..1000]</p>
<p>sum_mult_15 = sum [15,30..1000]</p>
<p>result = sum_mult_3 + sum_mult_5 &#8211; sum_mult_15</p>
<p>all these lines could be reduced to:</p>
<p>sum $ map sum [[3,6..1000],[5,10..1000],[(-15),(-30)..(-1000)]]</p>
<p>but this is less understandable <img src='http://www.webframp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matteo</title>
		<link>http://www.webframp.com/2009/04/15/why-haskell-is-a-joy-to-learn/comment-page-1/#comment-321</link>
		<dc:creator>Matteo</dc:creator>
		<pubDate>Fri, 17 Apr 2009 12:40:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.webframp.com/?p=119#comment-321</guid>
		<description>What about this?

sum [ a &#124; a &lt;- [1..999], any ((==) 0 . (a `mod`)) [3,5] ]

I&#039;m a beginner, so if it is any wrong please tell me. :-)</description>
		<content:encoded><![CDATA[<p>What about this?</p>
<p>sum [ a | a &lt;- [1..999], any ((==) 0 . (a `mod`)) [3,5] ]</p>
<p>I&#8217;m a beginner, so if it is any wrong please tell me. <img src='http://www.webframp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: remi</title>
		<link>http://www.webframp.com/2009/04/15/why-haskell-is-a-joy-to-learn/comment-page-1/#comment-320</link>
		<dc:creator>remi</dc:creator>
		<pubDate>Fri, 17 Apr 2009 12:24:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.webframp.com/?p=119#comment-320</guid>
		<description>I would argue the last two attempts are much less clear than f.ex. Stephen Johnson&#039;s expression..</description>
		<content:encoded><![CDATA[<p>I would argue the last two attempts are much less clear than f.ex. Stephen Johnson&#8217;s expression..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: exlevan</title>
		<link>http://www.webframp.com/2009/04/15/why-haskell-is-a-joy-to-learn/comment-page-1/#comment-319</link>
		<dc:creator>exlevan</dc:creator>
		<pubDate>Fri, 17 Apr 2009 07:04:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.webframp.com/?p=119#comment-319</guid>
		<description>Without isMultOf:
sum [a &#124; a &lt;- [1..999], or $ map ((== 0) . mod a) [3,5]]</description>
		<content:encoded><![CDATA[<p>Without isMultOf:<br />
sum [a | a &lt;- [1..999], or $ map ((== 0) . mod a) [3,5]]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: josh</title>
		<link>http://www.webframp.com/2009/04/15/why-haskell-is-a-joy-to-learn/comment-page-1/#comment-318</link>
		<dc:creator>josh</dc:creator>
		<pubDate>Fri, 17 Apr 2009 00:28:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.webframp.com/?p=119#comment-318</guid>
		<description>Less repetitive:

a `isMultOf` b = a `mod` b == 0

sum [a &#124; a &lt;- [1..999], (a `isMultOf`) `any` [3,5]]</description>
		<content:encoded><![CDATA[<p>Less repetitive:</p>
<p>a `isMultOf` b = a `mod` b == 0</p>
<p>sum [a | a &lt;- [1..999], (a `isMultOf`) `any` [3,5]]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
