<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://behalek.cs.vsb.cz/wiki/index.php?action=history&amp;feed=atom&amp;title=FP_Laboratory_6%2Fen</id>
	<title>FP Laboratory 6/en - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://behalek.cs.vsb.cz/wiki/index.php?action=history&amp;feed=atom&amp;title=FP_Laboratory_6%2Fen"/>
	<link rel="alternate" type="text/html" href="http://behalek.cs.vsb.cz/wiki/index.php?title=FP_Laboratory_6/en&amp;action=history"/>
	<updated>2026-04-21T16:49:21Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.33.1</generator>
	<entry>
		<id>http://behalek.cs.vsb.cz/wiki/index.php?title=FP_Laboratory_6/en&amp;diff=3596&amp;oldid=prev</id>
		<title>FuzzyBot: Updating to match new version of source page</title>
		<link rel="alternate" type="text/html" href="http://behalek.cs.vsb.cz/wiki/index.php?title=FP_Laboratory_6/en&amp;diff=3596&amp;oldid=prev"/>
		<updated>2023-10-26T08:02:45Z</updated>

		<summary type="html">&lt;p&gt;Updating to match new version of source page&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 08:02, 26 October 2023&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Operators ==  &lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Operators ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*Define following functions that performs corresponding logic operations: &amp;lt;code&amp;gt;not&amp;#039;, and&amp;#039;, or&amp;#039;, nand&amp;#039;, xor&amp;#039;, impl&amp;#039;, equ&amp;#039;&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*Define following functions that performs corresponding logic operations: &amp;lt;code&amp;gt;not&amp;#039;, and&amp;#039;, or&amp;#039;, nand&amp;#039;, xor&amp;#039;, impl&amp;#039;, equ&amp;#039;&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*Define the &amp;#039;standard&amp;#039; priority for all these functions, if they are used as operators.  &lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;*Define the &amp;#039;standard&amp;#039; priority for all these functions, if they are used as operators.  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l114&quot; &gt;Line 114:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 114:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;div style=&amp;quot;clear:both&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;div style=&amp;quot;clear:both&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;== Additional exercises ==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* Create a function that divides a list of elements into the list lists using a separator.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;syntaxhighlight lang=&amp;quot;Haskell&amp;quot;&amp;gt;splitByElement :: Eq a =&amp;gt; [a] -&amp;gt; a -&amp;gt; [[a]]&amp;lt;/syntaxhighlight&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;syntaxhighlight lang=&amp;quot;Haskell&amp;quot; class=&amp;quot;myDark&amp;quot;&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;*Main&amp;gt; splitByElement &amp;quot;I love functional programming!&amp;quot; &amp;#039; &amp;#039;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[&amp;quot;I&amp;quot;,&amp;quot;love&amp;quot;,&amp;quot;functional&amp;quot;,&amp;quot;programming!&amp;quot;]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;*Main&amp;gt; splitByElement [1,2,1,2,3,4,5,5,6,4,1,2,0,1,4] 1&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[2],[2,3,4,5,5,6,4],[2,0],[4]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;*Main&amp;gt; splitByElement [1,2,1,2,3,4,5,5,6,4,1,2,0,1,4] 5&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[1,2,1,2,3,4],[6,4,1,2,0,1,4]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>FuzzyBot</name></author>
		
	</entry>
	<entry>
		<id>http://behalek.cs.vsb.cz/wiki/index.php?title=FP_Laboratory_6/en&amp;diff=2749&amp;oldid=prev</id>
		<title>FuzzyBot: Updating to match new version of source page</title>
		<link rel="alternate" type="text/html" href="http://behalek.cs.vsb.cz/wiki/index.php?title=FP_Laboratory_6/en&amp;diff=2749&amp;oldid=prev"/>
		<updated>2021-10-20T10:15:05Z</updated>

		<summary type="html">&lt;p&gt;Updating to match new version of source page&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Operators == &lt;br /&gt;
*Define following functions that performs corresponding logic operations: &amp;lt;code&amp;gt;not&amp;#039;, and&amp;#039;, or&amp;#039;, nand&amp;#039;, xor&amp;#039;, impl&amp;#039;, equ&amp;#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
*Define the &amp;#039;standard&amp;#039; priority for all these functions, if they are used as operators. &lt;br /&gt;
*Create a function that prints the truth table of a given logical expression for two variables.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Haskell&amp;quot;&amp;gt;table :: (Bool -&amp;gt; Bool -&amp;gt; Bool) -&amp;gt; IO ()&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Haskell&amp;quot; class=&amp;quot;myDark&amp;quot;&amp;gt;&lt;br /&gt;
table (\a b -&amp;gt; (and&amp;#039; a (or&amp;#039; a b)))                                                                              &lt;br /&gt;
True  True  True&lt;br /&gt;
True  False True&lt;br /&gt;
False True  False&lt;br /&gt;
False False False&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; data-collapsetext=&amp;quot;Hide solution&amp;quot; data-expandtext=&amp;quot;Show solution&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Haskell&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
not&amp;#039; :: Bool -&amp;gt; Bool&lt;br /&gt;
not&amp;#039; True = False&lt;br /&gt;
not&amp;#039; False = True&lt;br /&gt;
infixl 5 `not&amp;#039;` &lt;br /&gt;
&lt;br /&gt;
and&amp;#039; :: Bool -&amp;gt; Bool -&amp;gt; Bool&lt;br /&gt;
and&amp;#039; True True = True&lt;br /&gt;
and&amp;#039; _ _ = False&lt;br /&gt;
infixl 4 `and&amp;#039;` &lt;br /&gt;
&lt;br /&gt;
or&amp;#039; :: Bool -&amp;gt; Bool -&amp;gt; Bool&lt;br /&gt;
or&amp;#039; False False = False&lt;br /&gt;
or&amp;#039; _ _ = True&lt;br /&gt;
infixl 3 `or&amp;#039;` &lt;br /&gt;
&lt;br /&gt;
nand&amp;#039; :: Bool -&amp;gt; Bool -&amp;gt; Bool&lt;br /&gt;
nand&amp;#039; x y = not&amp;#039; (and&amp;#039; x y)&lt;br /&gt;
infixl 4 `nand&amp;#039;` &lt;br /&gt;
&lt;br /&gt;
xor&amp;#039; :: Bool -&amp;gt; Bool -&amp;gt; Bool&lt;br /&gt;
xor&amp;#039; x y = x/=y&lt;br /&gt;
infixl 3 `xor&amp;#039;` &lt;br /&gt;
&lt;br /&gt;
impl&amp;#039; :: Bool -&amp;gt; Bool -&amp;gt; Bool&lt;br /&gt;
impl&amp;#039; True False = False&lt;br /&gt;
impl&amp;#039; _ _ = True&lt;br /&gt;
infixl 2 `impl&amp;#039;` &lt;br /&gt;
&lt;br /&gt;
equ&amp;#039; :: Bool -&amp;gt; Bool -&amp;gt; Bool&lt;br /&gt;
equ&amp;#039; x y = x == y&lt;br /&gt;
infixl 7 `equ&amp;#039;` &lt;br /&gt;
&lt;br /&gt;
table :: (Bool -&amp;gt; Bool -&amp;gt; Bool) -&amp;gt; IO ()&lt;br /&gt;
table expr = putStr (concat [nicePrint [x,y,(expr x y)] |x&amp;lt;-[True,False], y&amp;lt;-[True,False]])&lt;br /&gt;
&lt;br /&gt;
nicePrint :: [Bool] -&amp;gt; String&lt;br /&gt;
nicePrint xs = concat [show x++&amp;quot;\t&amp;quot;| x&amp;lt;-xs] ++ &amp;quot;\n&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[File:Tryit.png|center|60px|Try it!|link=https://rextester.com/GWCM50489]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;clear:both&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Extend the previously defined function to accept any number of variables (the number of variables will be given as a first parameter).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Haskell&amp;quot;&amp;gt;tablen :: Int -&amp;gt; ([Bool] -&amp;gt; Bool) -&amp;gt; IO ()&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Haskell&amp;quot; class=&amp;quot;myDark&amp;quot;&amp;gt;&lt;br /&gt;
 tablen 3 (\[a,b,c] -&amp;gt; a `and&amp;#039;` (b `or&amp;#039;` c) `equ&amp;#039;` a `and&amp;#039;` b `or&amp;#039;` a `and&amp;#039;` c)&lt;br /&gt;
True   True   True   =&amp;gt; True&lt;br /&gt;
True   True   False  =&amp;gt; True&lt;br /&gt;
True   False  True   =&amp;gt; True&lt;br /&gt;
True   False  False  =&amp;gt; False&lt;br /&gt;
False  True   True   =&amp;gt; False&lt;br /&gt;
False  True   False  =&amp;gt; False&lt;br /&gt;
False  False  True   =&amp;gt; False&lt;br /&gt;
False  False  False  =&amp;gt; False&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; data-collapsetext=&amp;quot;Hide solution&amp;quot; data-expandtext=&amp;quot;Show solution&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Haskell&amp;quot;&amp;gt;&lt;br /&gt;
tablen :: Int -&amp;gt; ([Bool] -&amp;gt; Bool) -&amp;gt; IO ()&lt;br /&gt;
tablen n f = putStr(concat [nicePrint x ++ &amp;quot; =&amp;gt; &amp;quot; ++ show(f x) ++ &amp;quot;\n&amp;quot; |x&amp;lt;-allValues n]) where &lt;br /&gt;
  allValues 1 = [[True], [False]]&lt;br /&gt;
  allValues n = [x:y| x&amp;lt;-[True,False], y&amp;lt;-allValues (n-1)]&lt;br /&gt;
&lt;br /&gt;
  nicePrint :: [Bool] -&amp;gt; String&lt;br /&gt;
  nicePrint xs = concat [show x++&amp;quot;\t&amp;quot;| x&amp;lt;-xs]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[File:Tryit.png|center|60px|Try it!|link=https://rextester.com/IDZIG48578]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;clear:both&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Complex function - Huffman Codes ==&lt;br /&gt;
*Create a function that will compute [https://en.wikipedia.org/wiki/Huffman_coding Huffman codes] for a given list of characters and their frequencies.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right&amp;quot;&amp;gt; [[File:Video logo.png|80px|link=https://youtu.be/HWYQZtbxMhc]]&amp;lt;/div&amp;gt; &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Haskell&amp;quot;&amp;gt;huffman :: [(Char, Int)] -&amp;gt; [(Char, String)]&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Haskell&amp;quot; class=&amp;quot;myDark&amp;quot;&amp;gt;&lt;br /&gt;
*Main&amp;gt;  huffman [(&amp;#039;a&amp;#039;,45),(&amp;#039;b&amp;#039;,13),(&amp;#039;c&amp;#039;,12),(&amp;#039;d&amp;#039;,16),(&amp;#039;e&amp;#039;,9),(&amp;#039;f&amp;#039;,5)]&lt;br /&gt;
[(&amp;#039;a&amp;#039;,&amp;quot;0&amp;quot;),(&amp;#039;b&amp;#039;,&amp;quot;101&amp;quot;),(&amp;#039;c&amp;#039;,&amp;quot;100&amp;quot;),(&amp;#039;d&amp;#039;,&amp;quot;111&amp;quot;),(&amp;#039;e&amp;#039;,&amp;quot;1101&amp;quot;),(&amp;#039;f&amp;#039;,&amp;quot;1100&amp;quot;)]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible mw-collapsed&amp;quot; data-collapsetext=&amp;quot;Hide solution&amp;quot; data-expandtext=&amp;quot;Show solution&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Haskell&amp;quot;&amp;gt;&lt;br /&gt;
import Data.List (sortBy)&lt;br /&gt;
&lt;br /&gt;
huffman :: [(Char, Int)] -&amp;gt; [(Char, String)] &lt;br /&gt;
huffman input = &lt;br /&gt;
  let &lt;br /&gt;
    prep = [ (y, [(x,&amp;quot;&amp;quot;)] ) | (x,y)&amp;lt;-input]            &lt;br /&gt;
  in sortBy (\ (x,_) (y,_) -&amp;gt; compare x y) (step prep) where&lt;br /&gt;
     step :: [(Int, [(Char, String)])] -&amp;gt; [(Char, String)]&lt;br /&gt;
     step [(_, result) ] = result&lt;br /&gt;
     step list = let ((a1, as2):(b1,bs2):rest) = sortBy (\ (x,_) (y,_) -&amp;gt; compare x y) list&lt;br /&gt;
                 in step ((a1+b1, [(x,&amp;#039;0&amp;#039;:a2)|(x,a2)&amp;lt;-as2]++[(x,&amp;#039;1&amp;#039;:b2)|(x,b2)&amp;lt;-bs2])  : rest)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
[[File:Tryit.png|center|60px|Try it!|link=https://rextester.com/PSSTZ19890]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;clear:both&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>FuzzyBot</name></author>
		
	</entry>
</feed>