<?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>Haskell Notes</title>
	<atom:link href="http://robotics.icstweb.org/haskell/feed/" rel="self" type="application/rss+xml" />
	<link>http://robotics.icstweb.org/haskell</link>
	<description></description>
	<lastBuildDate>Thu, 16 Oct 2008 20:51:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Prime numbers: using sets</title>
		<link>http://robotics.icstweb.org/haskell/2008/10/16/prime-numbers-using-sets/</link>
		<comments>http://robotics.icstweb.org/haskell/2008/10/16/prime-numbers-using-sets/#comments</comments>
		<pubDate>Thu, 16 Oct 2008 20:51:48 +0000</pubDate>
		<dc:creator>Fieral</dc:creator>
				<category><![CDATA[Haskell]]></category>

		<guid isPermaLink="false">http://robotics.icstweb.org/haskell/?p=31</guid>
		<description><![CDATA[module Main where import IO readNum :: IO Integer readNum = readLn - &#8211;  define divisors set: divisors :: Integer -&#62; [Integer] divisors n = [m &#124; m &#60;- [1 .. n], n `mod` m == 0] - &#8211; In mathematics, “a prime number” (or “a prime”) is a natural number – &#8211; which has [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left">module Main where<br />
import IO</p>
<p style="text-align: left">readNum :: IO Integer<br />
readNum = readLn</p>
<p style="text-align: left">- &#8211;  define divisors set:<br />
divisors :: Integer -&gt; [Integer]<br />
divisors n = [m | m &lt;- [1 .. n], n `mod` m == 0]</p>
<p><img src="http://robotics.icstweb.org/haskell/wp-content/cache/tex_509e909774a39ecc56b89741ec0383cc.png" align="absmiddle" class="tex" alt="\mbox{divisors}\left(n\right)=\left\{m\in\{1..n\}| \mbox{where}\; n \mathop{\mathrm{mod}}\nolimits m=0 \right\}" /></p>
<p style="text-align: left">- &#8211; In mathematics, “a prime number” (or “a prime”) is a natural number<br />
– &#8211; which has exactly two distinct natural number divisors: 1 and itself<br />
isPrime :: Integer -&gt; Bool<br />
isPrime 0 = False<br />
isPrime 1 = False<br />
isPrime n = (divisors n) == [1, n]</p>
<p style="text-align: left">- &#8211; returns all Prime numbers from 0 to a by filtering Integer set<br />
primes :: Integer -&gt; [Integer]<br />
primes a = filter isPrime [1 .. a]</p>
<p style="text-align: left">main = do<br />
hSetBuffering stdout NoBuffering<br />
putStr   &#8220;Enter A: &#8221;<br />
a &lt;- readNum</p>
<p style="text-align: left">print (primes a)</p>
]]></content:encoded>
			<wfw:commentRss>http://robotics.icstweb.org/haskell/2008/10/16/prime-numbers-using-sets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>functional &#8220;FOR&#8221; loops</title>
		<link>http://robotics.icstweb.org/haskell/2008/10/16/functional-for-loops/</link>
		<comments>http://robotics.icstweb.org/haskell/2008/10/16/functional-for-loops/#comments</comments>
		<pubDate>Thu, 16 Oct 2008 19:58:13 +0000</pubDate>
		<dc:creator>Fieral</dc:creator>
				<category><![CDATA[Haskell]]></category>

		<guid isPermaLink="false">http://robotics.icstweb.org/haskell/?p=29</guid>
		<description><![CDATA[&#8211; functional FOR: a, b &#8211; interval set (Integer), f &#8211; &#8220;FOR&#8221;-internal block for :: Integer-&#62;Integer-&#62;(Integer-&#62;IO())-&#62;IO() for a b f = foldr ((&#62;&#62;).f) (return()) [a..b] &#8211; functional FOR: a, b &#8211; interval set (Any type), f &#8211; &#8220;FOR&#8221;-internal block for :: (Enum a, Monad m) =&#62; a -&#62; a -&#62; (a -&#62; m b) -&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>&#8211; functional FOR: a, b &#8211; interval set (Integer), f &#8211; &#8220;FOR&#8221;-internal block<br />
for :: Integer-&gt;Integer-&gt;(Integer-&gt;IO())-&gt;IO()<br />
for a b f = foldr ((&gt;&gt;).f) (return()) [a..b]</p>
<p>&#8211; functional FOR: a, b &#8211; interval set (Any type), f &#8211; &#8220;FOR&#8221;-internal block<br />
for :: (Enum a, Monad m) =&gt; a -&gt; a -&gt; (a -&gt; m b) -&gt; m ()<br />
for a b f = mapM_ f [a..b]</p>
<p>&#8211;using:<br />
for 1 100 somekindofprocedure</p>
]]></content:encoded>
			<wfw:commentRss>http://robotics.icstweb.org/haskell/2008/10/16/functional-for-loops/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>functional FOR</title>
		<link>http://robotics.icstweb.org/haskell/2008/10/14/functional-for/</link>
		<comments>http://robotics.icstweb.org/haskell/2008/10/14/functional-for/#comments</comments>
		<pubDate>Tue, 14 Oct 2008 18:44:20 +0000</pubDate>
		<dc:creator>Fieral</dc:creator>
				<category><![CDATA[Haskell]]></category>

		<guid isPermaLink="false">http://robotics.icstweb.org/haskell/?p=23</guid>
		<description><![CDATA[- &#8211; functional FOR where: [a, b] &#8211; interval set, f &#8211; &#8220;FOR&#8221;-internal block: for::Integer-&#62;Integer-&#62;(Integer-&#62;IO())-&#62;IO() for a b f = foldr ((&#62;&#62;).f) (return()) [a..b] - &#8211; printing prime numbers using functional FOR: printRec2 a = do for 1 a ch - &#8211; printing prime numbers using recursion: printRec a = do if ( a &#62; [...]]]></description>
			<content:encoded><![CDATA[<p><strong>- &#8211; functional FOR where: [a, b] &#8211; interval set, f &#8211; &#8220;FOR&#8221;-internal block:<br />
for::Integer-&gt;Integer-&gt;(Integer-&gt;IO())-&gt;IO()<br />
for a b f = foldr ((&gt;&gt;).f) (return()) [a..b]</strong></p>
<p>- &#8211; printing prime numbers using functional FOR:<br />
printRec2 a = do<br />
for 1 a ch</p>
<p>- &#8211; printing prime numbers using recursion:<br />
printRec a = do<br />
if ( a &gt; 1 )<br />
then do<br />
printRec (a-1)<br />
ch a<br />
else return()</p>
<p>- &#8211; procedure-printer:<br />
ch a = do<br />
if pr a<br />
then putStr ( &#8220;The &#8221; ++ show(a) ++ &#8221; is a Prime number&#8221; ++ &#8220;\n&#8221; )<br />
else return()</p>
<p>Full code:<span id="more-23"></span></p>
<p>- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -</p>
<p>module Main where<br />
import IO</p>
<p>- &#8211; function ost(a,b) returns residue of division of a number by b number<br />
ost :: Integer -&gt; Integer -&gt; Integer<br />
ost a b | a &gt;= b = ost (a-b) b<br />
ost a b | a &lt; b = a</p>
<p>- &#8211; In mathematics, a prime number (or a prime) is a natural number<br />
- &#8211; which has exactly two distinct natural number divisors: 1 and itself<br />
pr :: Integer -&gt; Bool<br />
pr 0 = False<br />
pr 1 = False<br />
pr 2 = True<br />
pr n = dne n 2 (n-1)</p>
<p>- &#8211; functional FOR: a, b &#8211; interval set, f &#8211; &#8220;FOR&#8221;-internal block<br />
for::Integer-&gt;Integer-&gt;(Integer-&gt;IO())-&gt;IO()<br />
for a b f = foldr ((&gt;&gt;).f) (return()) [a..b]</p>
<p>- &#8211; printing prime numbers using FOR<br />
printRec2 a = do<br />
for 1 a ch</p>
<p>- &#8211; printing prime numbers using recursion<br />
printRec a = do<br />
if ( a &gt; 1 )<br />
then do<br />
printRec (a-1)<br />
ch a<br />
else return()</p>
<p>- &#8211; procedure-printer<br />
ch a = do<br />
if pr a<br />
then putStr ( &#8220;The &#8221; ++ show(a) ++ &#8221; is a Prime number&#8221; ++ &#8220;\n&#8221; )<br />
else return()</p>
<p>- &#8211; ned A B C == &#8220;There is no devisors of A at [B,C] segment&#8221;<br />
dne :: Integer -&gt; Integer -&gt; Integer -&gt; Bool<br />
dne a b c | b == c = (ost a b /= 0)<br />
dne a b c | b &gt; c = True<br />
dne a b c | b &lt; c = (dne a b (c-1))&amp;&amp;(dne a c c)</p>
<p>readNum :: IO Integer<br />
readNum = readLn</p>
<p>main = do<br />
hSetBuffering stdout NoBuffering<br />
putStr   &#8220;Enter A: &#8221;<br />
a &lt;- readNum<br />
printRec a</p>
]]></content:encoded>
			<wfw:commentRss>http://robotics.icstweb.org/haskell/2008/10/14/functional-for/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Prime number cheking</title>
		<link>http://robotics.icstweb.org/haskell/2008/10/13/prime-number-cheking/</link>
		<comments>http://robotics.icstweb.org/haskell/2008/10/13/prime-number-cheking/#comments</comments>
		<pubDate>Mon, 13 Oct 2008 22:19:55 +0000</pubDate>
		<dc:creator>Fieral</dc:creator>
				<category><![CDATA[Haskell]]></category>

		<guid isPermaLink="false">http://robotics.icstweb.org/haskell/?p=21</guid>
		<description><![CDATA[module Main where import IO &#8211; function ost( A, B ) returns residue of division of A number by B number ost :: Integer -&#62; Integer -&#62; Integer ost a b &#124; a &#62;= b = ost (a-b) b ost a b &#124; a &#60; b = a &#8211; In mathematics, &#8220;a prime number&#8221; (or [...]]]></description>
			<content:encoded><![CDATA[<p>module Main where<br />
import IO</p>
<p>&#8211; function ost( A, B ) returns residue of division of A number by B number<br />
ost :: Integer -&gt; Integer -&gt; Integer<br />
ost a b | a &gt;= b = ost (a-b) b<br />
ost a b | a &lt; b = a</p>
<p>&#8211; In mathematics, &#8220;a prime number&#8221; (or &#8220;a prime&#8221;) is a natural number<br />
&#8211; which has exactly two distinct natural number divisors: 1 and itself<br />
pr :: Integer -&gt; Bool<br />
pr 1 = False<br />
pr 2 = True<br />
pr n = dne n 2 (n-1)</p>
<p>&#8211;ned A B C == &#8220;There is no devisors of A at [B,C] segment&#8221;<br />
dne :: Integer -&gt; Integer -&gt; Integer -&gt; Bool<br />
dne a b c | b == c = (ost a b /= 0)<br />
dne a b c | b &gt; c = True<br />
dne a b c | b &lt; c = (dne a b (c-1))&amp;&amp;(dne a c c)</p>
<p>readNum :: IO Integer<br />
readNum = readLn</p>
<p>main = do<br />
hSetBuffering stdout NoBuffering<br />
putStr   &#8220;Enter A: &#8221;<br />
a &lt;- readNum</p>
<p>putStr  (&#8220;The &#8220;++ show (a) ++ &#8221; is a Prime number = &#8221; ++ show (pr a) ++ &#8220;\n&#8221;)</p>
]]></content:encoded>
			<wfw:commentRss>http://robotics.icstweb.org/haskell/2008/10/13/prime-number-cheking/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>residue of division</title>
		<link>http://robotics.icstweb.org/haskell/2008/10/13/residue-of-division/</link>
		<comments>http://robotics.icstweb.org/haskell/2008/10/13/residue-of-division/#comments</comments>
		<pubDate>Mon, 13 Oct 2008 21:45:33 +0000</pubDate>
		<dc:creator>Fieral</dc:creator>
				<category><![CDATA[Haskell]]></category>

		<guid isPermaLink="false">http://robotics.icstweb.org/haskell/?p=19</guid>
		<description><![CDATA[module Main where import IO &#8211; function ost(a,b) returns residue of division of A number by B number ost :: Integer -&#62; Integer -&#62; Integer ost a b &#124; a &#62;= b = ost (a-b) b ost a b &#124; a &#60; b = a readNum :: IO Integer readNum = readLn main = do [...]]]></description>
			<content:encoded><![CDATA[<p>module Main where<br />
import IO</p>
<p>&#8211; function ost(a,b) returns residue of division of A number by B number<br />
ost :: Integer -&gt; Integer -&gt; Integer<br />
ost a b | a &gt;= b = ost (a-b) b<br />
ost a b | a &lt; b = a</p>
<p>readNum :: IO Integer<br />
readNum = readLn</p>
<p>main = do<br />
hSetBuffering stdout NoBuffering<br />
putStr   &#8220;Enter A: &#8221;<br />
a &lt;- readNum<br />
putStr   &#8220;Enter B: &#8221;<br />
b &lt;- readNum</p>
<p>putStr  (&#8220;residue of division of the A number by the B number = &#8221; ++ show (ost a b) ++ &#8220;\n&#8221;)</p>
]]></content:encoded>
			<wfw:commentRss>http://robotics.icstweb.org/haskell/2008/10/13/residue-of-division/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>a -&gt; a! (factorial with argument)</title>
		<link>http://robotics.icstweb.org/haskell/2008/10/13/a-a-factorial-with-argument/</link>
		<comments>http://robotics.icstweb.org/haskell/2008/10/13/a-a-factorial-with-argument/#comments</comments>
		<pubDate>Mon, 13 Oct 2008 20:59:41 +0000</pubDate>
		<dc:creator>Fieral</dc:creator>
				<category><![CDATA[Haskell]]></category>

		<guid isPermaLink="false">http://robotics.icstweb.org/haskell/?p=17</guid>
		<description><![CDATA[module Main where import IO fact :: Integer -&#62; Integer fact 0 = 1 fact n = n * fact (n &#8211; 1) readNum :: IO Integer readNum = readLn main = do hSetBuffering stdout NoBuffering putStr &#8220;Enter a: &#8221; a &#60;- readNum putStr (&#8220;a! = &#8221; ++ show (fact(a)) ++ &#8220;\n&#8221;)]]></description>
			<content:encoded><![CDATA[<p>module Main where<br />
import IO</p>
<p>fact :: Integer -&gt; Integer<br />
fact 0 = 1<br />
fact n = n * fact (n &#8211; 1)</p>
<p>readNum :: IO Integer<br />
readNum = readLn</p>
<p>main = do<br />
hSetBuffering stdout NoBuffering<br />
putStr   &#8220;Enter a: &#8221;<br />
a &lt;- readNum<br />
putStr  (&#8220;a! = &#8221; ++ show (fact(a)) ++ &#8220;\n&#8221;)</p>
]]></content:encoded>
			<wfw:commentRss>http://robotics.icstweb.org/haskell/2008/10/13/a-a-factorial-with-argument/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>a+b (integer)</title>
		<link>http://robotics.icstweb.org/haskell/2008/10/13/ab-integer/</link>
		<comments>http://robotics.icstweb.org/haskell/2008/10/13/ab-integer/#comments</comments>
		<pubDate>Mon, 13 Oct 2008 20:46:55 +0000</pubDate>
		<dc:creator>Fieral</dc:creator>
				<category><![CDATA[Haskell]]></category>

		<guid isPermaLink="false">http://robotics.icstweb.org/haskell/?p=15</guid>
		<description><![CDATA[module Main where import IO main = do hSetBuffering stdout NoBuffering putStr &#8220;Enter a: &#8221; x1 &#60;- readNum putStr &#8220;Enter b: &#8221; x2 &#60;- readNum putStr (&#8220;a + b = &#8221; ++ show (x1+x2) ++ &#8220;\n&#8221;) where readNum :: IO Integer readNum = readLn]]></description>
			<content:encoded><![CDATA[<p>module Main where<br />
import IO</p>
<p>main = do<br />
hSetBuffering stdout NoBuffering<br />
putStr   &#8220;Enter a: &#8221;<br />
x1 &lt;- readNum<br />
putStr   &#8220;Enter b: &#8221;<br />
x2 &lt;- readNum<br />
putStr  (&#8220;a + b = &#8221; ++ show (x1+x2) ++ &#8220;\n&#8221;)<br />
where readNum :: IO Integer</p>
<p>readNum = readLn</p>
]]></content:encoded>
			<wfw:commentRss>http://robotics.icstweb.org/haskell/2008/10/13/ab-integer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>factorial example</title>
		<link>http://robotics.icstweb.org/haskell/2008/10/13/factorial-example/</link>
		<comments>http://robotics.icstweb.org/haskell/2008/10/13/factorial-example/#comments</comments>
		<pubDate>Mon, 13 Oct 2008 20:10:27 +0000</pubDate>
		<dc:creator>Fieral</dc:creator>
				<category><![CDATA[Haskell]]></category>

		<guid isPermaLink="false">http://robotics.icstweb.org/haskell/?p=6</guid>
		<description><![CDATA[module Main where fact :: Integer -&#62; Integer fact 0 = 1 fact n = n * fact (n &#8211; 1) main = print (fact 1000)]]></description>
			<content:encoded><![CDATA[<p>module Main where</p>
<p>fact :: Integer -&gt; Integer<br />
fact 0 = 1<br />
fact n = n * fact (n &#8211; 1)</p>
<p>main = print (fact 1000)</p>
]]></content:encoded>
			<wfw:commentRss>http://robotics.icstweb.org/haskell/2008/10/13/factorial-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>first program</title>
		<link>http://robotics.icstweb.org/haskell/2008/10/09/first-program/</link>
		<comments>http://robotics.icstweb.org/haskell/2008/10/09/first-program/#comments</comments>
		<pubDate>Thu, 09 Oct 2008 17:58:26 +0000</pubDate>
		<dc:creator>Fieral</dc:creator>
				<category><![CDATA[Haskell]]></category>

		<guid isPermaLink="false">http://robotics.icstweb.org/Haskell/?p=4</guid>
		<description><![CDATA[1 2 3 4 5 module Main where main = printRec 1 printRec 100000 = print 100000 printRec i = do print i printRec &#40;i+1&#41;]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="haskell" style="font-family:monospace;"><span style="color: #06c; font-weight: bold;">module</span> Main <span style="color: #06c; font-weight: bold;">where</span>
main <span style="color: #339933; font-weight: bold;">=</span> printRec <span style="color: red;">1</span>
printRec <span style="color: red;">100000</span> <span style="color: #339933; font-weight: bold;">=</span> <span style="font-weight: bold;">print</span> <span style="color: red;">100000</span>
printRec i <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #06c; font-weight: bold;">do</span> <span style="font-weight: bold;">print</span> i
		printRec <span style="color: green;">&#40;</span>i<span style="color: #339933; font-weight: bold;">+</span><span style="color: red;">1</span><span style="color: green;">&#41;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://robotics.icstweb.org/haskell/2008/10/09/first-program/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
