<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>OOFP 2025-26</title>
    <link>https://unibz-oofp-25-26.github.io/</link>
    <description>Recent content on OOFP 2025-26</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <atom:link href="https://unibz-oofp-25-26.github.io/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Enumerated type</title>
      <link>https://unibz-oofp-25-26.github.io/docs/composite/sections/enum/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/composite/sections/enum/</guid>
      <description>&lt;h1 id=&#34;enumerated-type&#34;&gt;&#xA;  Enumerated type&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#enumerated-type&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;An enumerated type is a finite set of alternative values.&lt;/p&gt;&#xA;&lt;!-- This is a more readable alternative to so-called &#34;magic numbers&#34;, --&gt;&#xA;&lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Example.&lt;/em&gt;&lt;/strong&gt;&#xA;A playing card can have one of four suits: Clubs, Diamonds, Hearts or Spades.&lt;/p&gt;&#xA;&lt;p&gt;In the &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/ass/sections/ass1/&#34;&gt;first assignment&lt;/a&gt;, we modeled these values as four characters &lt;code&gt;&#39;C&#39;&lt;/code&gt;, &lt;code&gt;&#39;D&#39;&lt;/code&gt;, &lt;code&gt;&#39;H&#39;&lt;/code&gt; or &lt;code&gt;&#39;S&#39;&lt;/code&gt;.&#xA;This solution is unsatisfying, because the type &lt;code&gt;Char&lt;/code&gt; allows other letters.&#xA;Instead, we could declare an enumerated type (for instance named &lt;code&gt;Suit&lt;/code&gt;) with 4 possible values (&lt;code&gt;Clubs&lt;/code&gt;, &lt;code&gt;Diamonds&lt;/code&gt;, &lt;code&gt;Hearts&lt;/code&gt; and &lt;code&gt;Spades&lt;/code&gt;).&lt;/p&gt;</description>
    </item>
    <item>
      <title>Linear recursion</title>
      <link>https://unibz-oofp-25-26.github.io/docs/recursion/sections/linear/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/recursion/sections/linear/</guid>
      <description>&lt;h1 id=&#34;linear-recursion&#34;&gt;&#xA;  Linear recursion&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#linear-recursion&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Definition.&lt;/em&gt;&lt;/strong&gt;&#xA;A recursive function/method is &lt;strong&gt;linear recursive&lt;/strong&gt; if it performs at most &lt;em&gt;one&lt;/em&gt; recursive call each time it is executed.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Hint.&lt;/em&gt;&lt;/strong&gt;&#xA;In an imperative language (like Java),&#xA;a linear recursive algorithm can easily be transformed into an iterative one (i.e. an algorithm that uses only loops).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Haskell does not admit loops, so linear recursion is the standard way to perform simple iterations (although &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/control/sections/comprehension/&#34;&gt;list comprehensions&lt;/a&gt; can be used instead in certain cases).&#xA;Accordingly, in this section, we will mostly use Haskell as an illustration.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Object</title>
      <link>https://unibz-oofp-25-26.github.io/docs/objects/sections/object/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/objects/sections/object/</guid>
      <description>&lt;h1 id=&#34;object&#34;&gt;&#xA;  Object&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#object&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;An object groups data in a meaningful way.&lt;/p&gt;&#xA;&lt;h2 id=&#34;a-simple-example-json&#34;&gt;&#xA;  A simple example: JSON&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#a-simple-example-json&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;p&gt;Here is a JSON object (in Javascript syntax) that describes the city of Florence:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#a6e22e&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Florence&amp;#34;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#a6e22e&#34;&gt;zipCode&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;50100&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A JSON object may contain other objects, as well as arrays (of values, &lt;em&gt;objects&lt;/em&gt; or &lt;em&gt;arrays&lt;/em&gt;).&#xA;For instance:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#a6e22e&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Alice&amp;#34;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#a6e22e&#34;&gt;age&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;26&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#a6e22e&#34;&gt;birthPlace&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Florence&amp;#34;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#a6e22e&#34;&gt;zipCode&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;50100&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  },&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#a6e22e&#34;&gt;jobs&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; [&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#a6e22e&#34;&gt;employer&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Kolping&amp;#34;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#a6e22e&#34;&gt;start&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;2021&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#a6e22e&#34;&gt;end&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;2022&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    },&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#a6e22e&#34;&gt;employer&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Eurac&amp;#34;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#a6e22e&#34;&gt;start&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;2023&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  ]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;&lt;p&gt;In JSON:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Organization</title>
      <link>https://unibz-oofp-25-26.github.io/docs/intro/sections/organization/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/intro/sections/organization/</guid>
      <description>&lt;h1 id=&#34;organization&#34;&gt;&#xA;  Organization&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#organization&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;The course consists of:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;20 lectures (40 hours), and&lt;/li&gt;&#xA;&lt;li&gt;10 labs (20 hours).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://www.unibz.it/it/faculties/engineering/academic-staff/person/37010-julien-corman&#34;&gt;Julien Corman&lt;/a&gt; will teach the lectures and labs.&lt;/p&gt;&#xA;&lt;h2 id=&#34;schedule&#34;&gt;&#xA;  Schedule&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#schedule&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;h3 id=&#34;lectures&#34;&gt;&#xA;  Lectures&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#lectures&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h3&gt;&#xA;&lt;p&gt;By default, lectures are scheduled on:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Tuesday 15:30 - 17:30&lt;/li&gt;&#xA;&lt;li&gt;Thursday 10:30 - 12:30&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Hint.&lt;/em&gt;&lt;/strong&gt;&#xA;Lectures can be followed via Teams (e.g. for students sitting at the back of the class),&#xA;by joining the corresponding meeting (in the &amp;ldquo;Lectures&amp;rdquo; channel of this course&amp;rsquo;s &lt;a href=&#34;https://teams.cloud.microsoft/l/team/19%3AuDGTNjgOwXDg-Cnzs-jT4SAVlQhalezzcrxXDFkC9-01%40thread.tacv2/conversations?groupId=b969dd60-9264-4e25-bd40-90fb8ea0c292&amp;amp;tenantId=92513267-03e3-401a-80d4-c58ed6674e3b&#34;&gt;Team&lt;/a&gt;).&lt;/p&gt;</description>
    </item>
    <item>
      <title>Paradigm</title>
      <link>https://unibz-oofp-25-26.github.io/docs/paradigm/sections/paradigm/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/paradigm/sections/paradigm/</guid>
      <description>&lt;h1 id=&#34;paradigm&#34;&gt;&#xA;  Paradigm&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#paradigm&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;&lt;p&gt;A programming &lt;a href=&#34;https://en.wikipedia.org/wiki/Programming_paradigm&#34;&gt;&lt;strong&gt;paradigm&lt;/strong&gt;&lt;/a&gt; is a way to write programs.&#xA;Paradigms include:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;imperative programming,&lt;/li&gt;&#xA;&lt;li&gt;object-oriented programming,&lt;/li&gt;&#xA;&lt;li&gt;functional programming,&lt;/li&gt;&#xA;&lt;li&gt;logical programming,&lt;/li&gt;&#xA;&lt;li&gt;etc.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Programming &lt;em&gt;languages&lt;/em&gt; are often categorized based on the paradigms that they support.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote class=&#34;book-hint danger&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Disclaimer.&lt;/em&gt;&lt;/strong&gt;&#xA;The boundaries of a paradigm are not always clear, and can be subjective.&#xA;For this reason, we will (cautiously) borrow descriptions from Wikipedia.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;imperative&#34;&gt;&#xA;  Imperative programming&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#imperative&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;h3 id=&#34;languages&#34;&gt;&#xA;  Languages&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#languages&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h3&gt;&#xA;&lt;p&gt;The most widely used programming languages are imperative.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Set, list, tuple</title>
      <link>https://unibz-oofp-25-26.github.io/docs/background/sections/set_list/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/background/sections/set_list/</guid>
      <description>&lt;h1 id=&#34;set-list-tuple&#34;&gt;&#xA;  Set, list, tuple&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#set-list-tuple&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;h2 id=&#34;set&#34;&gt;&#xA;  Set&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#set&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;&lt;p&gt;A &lt;strong&gt;set&lt;/strong&gt; can be (informally) viewed as a collection of elements with &lt;em&gt;no duplicate&lt;/em&gt; and in &lt;em&gt;no specific order&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Examples.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$\{2,5\}$ and $\{5,2\}$ are the same set,&lt;/li&gt;&#xA;&lt;li&gt;$\{2,5,2\}$ is not a set.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;!-- &lt;span&gt;&#xA;  \(\qquad \qquad \{1,5\}\)&#xA;&lt;/span&gt;&#xA; --&gt;&#xA;&lt;!----&gt;&#xA;&lt;!-- and --&gt;&#xA;&lt;!----&gt;&#xA;&lt;!-- &lt;span&gt;&#xA;  \( \qquad \qquad \{5,1\} \)&#xA;&lt;/span&gt;&#xA; --&gt;&#xA;&lt;h3 id=&#34;power-set&#34;&gt;&#xA;  Power set&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#power-set&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h3&gt;&#xA;&lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Definition.&lt;/em&gt;&lt;/strong&gt; The &lt;strong&gt;power set&lt;/strong&gt; $\mathcal{P}(X)$ of a set $X$ is the set of all subsets of $X$.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Tokens</title>
      <link>https://unibz-oofp-25-26.github.io/docs/haskell/sections/tokens/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/haskell/sections/tokens/</guid>
      <description>&lt;h1 id=&#34;tokens&#34;&gt;&#xA;  Tokens&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#tokens&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Syntax.&lt;/em&gt;&lt;/strong&gt; Here are syntactic constraints on basic elements of a Haskell program:&lt;/p&gt;&#xA;&lt;table&gt;&#xA;  &lt;thead&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;th&gt;meaning&lt;/th&gt;&#xA;          &lt;th&gt;syntax&lt;/th&gt;&#xA;          &lt;th&gt;examples&lt;/th&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/thead&gt;&#xA;  &lt;tbody&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;variable name&lt;/td&gt;&#xA;          &lt;td&gt;starts with a lower case letter&lt;/td&gt;&#xA;          &lt;td&gt;&lt;code&gt;x&lt;/code&gt;, &lt;code&gt;xs&lt;/code&gt;, &lt;code&gt;f&lt;/code&gt;, &lt;code&gt;remainder&lt;/code&gt;, &lt;code&gt;maxValue&lt;/code&gt;&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;function name&lt;/td&gt;&#xA;          &lt;td&gt;starts with a lower case letter&lt;/td&gt;&#xA;          &lt;td&gt;&lt;code&gt;square&lt;/code&gt;, &lt;code&gt;applyBoolOp&lt;/code&gt;&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;type&lt;/td&gt;&#xA;          &lt;td&gt;starts with an upper case letter&lt;/td&gt;&#xA;          &lt;td&gt;&lt;code&gt;Integer&lt;/code&gt;, &lt;code&gt;Char&lt;/code&gt;, &lt;code&gt;Bool&lt;/code&gt;&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;type variable&lt;/td&gt;&#xA;          &lt;td&gt;starts with a lower case letter&lt;/td&gt;&#xA;          &lt;td&gt;&lt;code&gt;a&lt;/code&gt;, &lt;code&gt;type&lt;/code&gt;, &lt;code&gt;baseType&lt;/code&gt;&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;constructor&lt;/td&gt;&#xA;          &lt;td&gt;starts with a capital letter&lt;/td&gt;&#xA;          &lt;td&gt;&lt;code&gt;Cons&lt;/code&gt;, &lt;code&gt;CityC&lt;/code&gt;, &lt;code&gt;True&lt;/code&gt;&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;/blockquote&gt;</description>
    </item>
    <item>
      <title>Type variable</title>
      <link>https://unibz-oofp-25-26.github.io/docs/generic/sections/variable/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/generic/sections/variable/</guid>
      <description>&lt;h1 id=&#34;type-variable&#34;&gt;&#xA;  Type variable&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#type-variable&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;&lt;p&gt;A &lt;strong&gt;&lt;em&gt;type variable&lt;/em&gt;&lt;/strong&gt; stands for an underspecified type.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Example.&lt;/em&gt;&lt;/strong&gt;&#xA;Consider a function &lt;code&gt;half&lt;/code&gt; that maps a list to its first half (say rounded down if the list has odd length).&lt;/p&gt;&#xA;&lt;p&gt;The implementation of this function is identical for:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;a list of strings,&lt;/li&gt;&#xA;&lt;li&gt;a list of integers,&lt;/li&gt;&#xA;&lt;li&gt;a list of Boolean values,&lt;/li&gt;&#xA;&lt;li&gt;etc.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;A type variable lets us declare such a function&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;in Haskell:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-haskell&#34; data-lang=&#34;haskell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;half&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt; [a] &lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt; [a]    &lt;span style=&#34;color:#75715e&#34;&gt;-- `a` is a type variable here&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;or in Java:&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;/* will be revealed later */&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!-- ```java --&gt;&#xA;&lt;!-- /*`T` is a type variable in this declaration */ --&gt;&#xA;&lt;!-- &lt;T&gt; List&lt;T&gt; half (List&lt;T&gt; inputList) --&gt;&#xA;&lt;!-- ``` --&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;haskell&#34;&gt;&#xA;  In Haskell&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#haskell&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Syntax.&lt;/em&gt;&lt;/strong&gt;&#xA;In Haskell, a type variable starts with a lowercase letter (like a regular variable).&lt;/p&gt;</description>
    </item>
    <item>
      <title>Assignment 1</title>
      <link>https://unibz-oofp-25-26.github.io/docs/ass/sections/ass1/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/ass/sections/ass1/</guid>
      <description>&lt;h1 id=&#34;assignment-1-higher-order-functions-and-linear-recursion&#34;&gt;&#xA;  Assignment 1: higher-order functions and linear recursion&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#assignment-1-higher-order-functions-and-linear-recursion&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Hint.&lt;/em&gt;&lt;/strong&gt;&#xA;In this assignment,&#xA;you can often take advantage of the native &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/higher/sections/useful_hofs/&#34;&gt;higher-order functions&lt;/a&gt; that we have encountered: &lt;code&gt;filter&lt;/code&gt;, &lt;code&gt;map&lt;/code&gt;, &lt;code&gt;all&lt;/code&gt;, &lt;code&gt;any&lt;/code&gt;, etc.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;exercise-1-utility-functions&#34;&gt;&#xA;  Exercise 1: utility functions&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#exercise-1-utility-functions&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;p&gt;Implement the functions below by completing the function stubs in the file &lt;code&gt;Src/Utility.hs&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Hint.&lt;/em&gt;&lt;/strong&gt;&#xA;Some of these functions can be used to implement others.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Hint.&lt;/em&gt;&lt;/strong&gt;&#xA;Feel free to create additional (auxiliary) functions to simplify your implementation.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Base types</title>
      <link>https://unibz-oofp-25-26.github.io/docs/haskell/sections/type/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/haskell/sections/type/</guid>
      <description>&lt;h1 id=&#34;base-types&#34;&gt;&#xA;  Base types&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#base-types&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;&lt;p&gt;A &lt;strong&gt;base type&lt;/strong&gt; in Haskell intuitively represents a set of values (like in Java, and many other languages).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Here are a few native base types:&lt;/p&gt;&#xA;&lt;table&gt;&#xA;  &lt;thead&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;th&gt;type&lt;/th&gt;&#xA;          &lt;th&gt;meaning&lt;/th&gt;&#xA;          &lt;th&gt;syntax of constants in Haskell&lt;/th&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/thead&gt;&#xA;  &lt;tbody&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;&lt;code&gt;Char&lt;/code&gt;&lt;/td&gt;&#xA;          &lt;td&gt;a Unicode character, like &lt;code&gt;b&lt;/code&gt;, &lt;code&gt;B&lt;/code&gt;, &lt;code&gt;5&lt;/code&gt;, &lt;code&gt;_&lt;/code&gt; or &lt;code&gt;\t&lt;/code&gt;.&lt;/td&gt;&#xA;          &lt;td&gt;&lt;code&gt;&#39;b&#39;&lt;/code&gt;, &lt;code&gt;&#39;B&#39;&lt;/code&gt;, &lt;code&gt;&#39;5&#39;&lt;/code&gt;, &lt;code&gt;&#39;_&#39;&lt;/code&gt; or &lt;code&gt;&#39;\t&#39;&lt;/code&gt; (single quotes)&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;&lt;code&gt;String&lt;/code&gt;&lt;/td&gt;&#xA;          &lt;td&gt;a sequence of Unicode characters, like &lt;code&gt;banana&lt;/code&gt; or &lt;code&gt;f?#\t5&lt;/code&gt;&lt;/td&gt;&#xA;          &lt;td&gt;&lt;code&gt;&amp;quot;banana&amp;quot;&lt;/code&gt; or &lt;code&gt;&amp;quot;f?#\t5&amp;quot;&lt;/code&gt; (double quotes)&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;&lt;code&gt;Bool&lt;/code&gt;&lt;/td&gt;&#xA;          &lt;td&gt;a Boolean value&lt;/td&gt;&#xA;          &lt;td&gt;&lt;code&gt;True&lt;/code&gt; or &lt;code&gt;False&lt;/code&gt;&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;&lt;code&gt;Integer&lt;/code&gt;&lt;/td&gt;&#xA;          &lt;td&gt;an arbitrary integer (i.e. an element of $\mathbb{Z}$)&lt;/td&gt;&#xA;          &lt;td&gt;&lt;code&gt;-42&lt;/code&gt;, &lt;code&gt;0&lt;/code&gt; or &lt;code&gt;3&lt;/code&gt;&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;&lt;code&gt;Int&lt;/code&gt;&lt;/td&gt;&#xA;          &lt;td&gt;an integer within a certain range, from $- 2^{63}$ to $2^{63} -1$ (i.e. 64 bits) by default.&lt;/td&gt;&#xA;          &lt;td&gt;&lt;code&gt;-42&lt;/code&gt;, &lt;code&gt;0&lt;/code&gt; or &lt;code&gt;3&lt;/code&gt;&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;&lt;code&gt;Float&lt;/code&gt;&lt;/td&gt;&#xA;          &lt;td&gt;a 32 bits floating-point number&lt;/td&gt;&#xA;          &lt;td&gt;&lt;code&gt;-42&lt;/code&gt;, &lt;code&gt;4472&lt;/code&gt;, &lt;code&gt;4472.0&lt;/code&gt; or &lt;code&gt;4472.1357&lt;/code&gt;&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/tbody&gt;&#xA;&lt;/table&gt;</description>
    </item>
    <item>
      <title>Class and instance</title>
      <link>https://unibz-oofp-25-26.github.io/docs/objects/sections/class/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/objects/sections/class/</guid>
      <description>&lt;h1 id=&#34;class-and-instance&#34;&gt;&#xA;  Class and instance&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#class-and-instance&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;A &lt;strong&gt;class&lt;/strong&gt; can be viewed as a &lt;em&gt;blueprint&lt;/em&gt; for a set of similar objects.&lt;/p&gt;&#xA;&lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Terminology.&lt;/em&gt;&lt;/strong&gt;&#xA;An object that follows this blueprint is called an &lt;strong&gt;instance&lt;/strong&gt; of the class.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Example.&lt;/em&gt;&lt;/strong&gt;&#xA;Consider the two following objects (in pseudocode):&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#a6e22e&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Florence&amp;#34;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#a6e22e&#34;&gt;zipCode&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;50100&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#a6e22e&#34;&gt;region&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Tuscany&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;$\qquad$&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#a6e22e&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Rome&amp;#34;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#a6e22e&#34;&gt;zipCode&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;00100&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#a6e22e&#34;&gt;region&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Lazio&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Each of these objects describes a city, and they share the same keys (&lt;code&gt;name&lt;/code&gt;, &lt;code&gt;zipCode&lt;/code&gt; and &lt;code&gt;region&lt;/code&gt;).&lt;/p&gt;</description>
    </item>
    <item>
      <title>Compile time vs runtime error</title>
      <link>https://unibz-oofp-25-26.github.io/docs/paradigm/sections/error/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/paradigm/sections/error/</guid>
      <description>&lt;h1 id=&#34;compile-time-vs-runtime-error&#34;&gt;&#xA;  Compile time vs runtime error&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#compile-time-vs-runtime-error&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Definition.&lt;/em&gt;&lt;/strong&gt;&#xA;In (pre)compiled languages (like Java, C/C++, C#, Haskell, Python, Go, Rust, etc.):&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A &lt;strong&gt;compile time error&lt;/strong&gt; prevents a program from compiling.&#xA;It can be thought of as a &amp;ldquo;syntactic&amp;rdquo; error.&lt;/li&gt;&#xA;&lt;li&gt;A &lt;strong&gt;runtime error&lt;/strong&gt; (also called a &lt;strong&gt;bug&lt;/strong&gt;) occurs during the execution of a program.&#xA;It may depend on the &lt;em&gt;input&lt;/em&gt; of the program.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Note.&lt;/em&gt;&lt;/strong&gt;&#xA;An IDE can identify some compile time errors (and highlight them), without even attempting to compile the program.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Intermediate result</title>
      <link>https://unibz-oofp-25-26.github.io/docs/recursion/sections/intermediate/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/recursion/sections/intermediate/</guid>
      <description>&lt;h1 id=&#34;recursion-and-intermediate-result&#34;&gt;&#xA;  Recursion and intermediate result&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#recursion-and-intermediate-result&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;In some cases, we need recursive calls to return &lt;em&gt;more information&lt;/em&gt; than what the function should compute.&lt;/p&gt;&#xA;&lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Example.&lt;/em&gt;&lt;/strong&gt;&#xA;We want to implement a function&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-haskell&#34; data-lang=&#34;haskell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;longestWord&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;String&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;Int&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;that maps a string to the length of its longest word.&lt;/p&gt;&#xA;&lt;p&gt;For simplicity, we will assume that words are separated by a blank space (noted &lt;code&gt;&#39; &#39;&lt;/code&gt; in Haskell).&lt;br&gt;&#xA;For instance,&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-haskell&#34; data-lang=&#34;haskell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;longestWord&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Hi there&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;should evaluate to &lt;code&gt;5&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/haskell/sections/list/#string&#34;&gt;Recall&lt;/a&gt; that a string in Haskell is an array of characters.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Material</title>
      <link>https://unibz-oofp-25-26.github.io/docs/intro/sections/material/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/intro/sections/material/</guid>
      <description>&lt;h1 id=&#34;course-material&#34;&gt;&#xA;  Course material&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#course-material&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;h2 id=&#34;lectures&#34;&gt;&#xA;  Lectures&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#lectures&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;p&gt;This website contains the lecture material.&lt;/p&gt;&#xA;&lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;&lt;p&gt;Additional readings are listed in the &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/intro/sections/resources/&#34;&gt;dedicated section&lt;/a&gt;.&#xA;We emphasize that these are &lt;em&gt;optional&lt;/em&gt; (the course is self-contained).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;assignments&#34;&gt;&#xA;  Assignments&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#assignments&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;p&gt;Assignments will be released via &lt;a href=&#34;https://codeboard.io/&#34;&gt;Codeboard&lt;/a&gt;.&lt;br&gt;&#xA;Details are provided in the &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/intro/sections/evaluation/#assignments&#34;&gt;dedicated section&lt;/a&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Passing by value or by reference</title>
      <link>https://unibz-oofp-25-26.github.io/docs/objects/sections/value_ref/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/objects/sections/value_ref/</guid>
      <description>&lt;h1 id=&#34;passing-by-value-or-by-reference&#34;&gt;&#xA;  Passing by value or by reference&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#passing-by-value-or-by-reference&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Definition.&lt;/em&gt;&lt;/strong&gt;&#xA;Imperative languages differ in the way arguments are passed to methods/functions.&#xA;Two common strategies are:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;passing by value&lt;/strong&gt;: the method receives as input a &lt;em&gt;copy&lt;/em&gt; of each argument.&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;passing by reference&lt;/strong&gt;: the method receives as input a &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/objects/sections/object/&#34;&gt;reference&lt;/a&gt; to each argument (which lets the method modify the originals).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Example.&lt;/em&gt;&lt;/strong&gt;&#xA;Consider the following program (in pseudocode):&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;myInteger &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; 0&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;myMethod&lt;/span&gt;(myInteger)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;print(myInteger)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;myMethod(argument){&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  argument &lt;span style=&#34;color:#f92672&#34;&gt;+=&lt;/span&gt; 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;If the argument is passed by value, then the program prints &lt;code&gt;0&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;If the argument is passed by reference, then the program prints &lt;code&gt;1&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;in-java&#34;&gt;&#xA;  In Java&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#in-java&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;&lt;p&gt;Java (and many other programming languages, like C, Python, Javascript, etc.) passes arguments &lt;a href=&#34;https://www.javadude.com/articles/passbyvalue.htm&#34;&gt;by value&lt;/a&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Pattern matching</title>
      <link>https://unibz-oofp-25-26.github.io/docs/control/sections/pattern/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/control/sections/pattern/</guid>
      <description>&lt;h1 id=&#34;pattern-matching&#34;&gt;&#xA;  Pattern matching&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#pattern-matching&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;Pattern matching is a traditional feature of functional languages.&#xA;It pairs well with &lt;a href=&#34;https://unibz-oofp-25-26.github.io/notreleased/&#34;&gt;sum types&lt;/a&gt; (which we will see later).&lt;/p&gt;&#xA;&lt;p&gt;Pattern matching is no longer exclusive to functional languages: several imperative languages now support it to some extent (natively or via libraries).&#xA;This includes:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;C# (since 2020),&lt;/li&gt;&#xA;&lt;li&gt;Java (since 2021),&lt;/li&gt;&#xA;&lt;li&gt;PHP (since 2021),&lt;/li&gt;&#xA;&lt;li&gt;Python (since 2021)&lt;/li&gt;&#xA;&lt;li&gt;Rust (since its first release in 2015).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;haskell&#34;&gt;&#xA;  in Haskell&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#haskell&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;&lt;p&gt;A &lt;strong&gt;pattern&lt;/strong&gt; is a syntactic expression that can match certain values.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Product type</title>
      <link>https://unibz-oofp-25-26.github.io/docs/composite/sections/product/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/composite/sections/product/</guid>
      <description>&lt;h1 id=&#34;product-type&#34;&gt;&#xA;  Product type&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#product-type&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;!-- A product type describes values that consist of valuessimplistic --&gt;&#xA;&lt;p&gt;A product type can be viewed as a simplistic &lt;a href=&#34;https://unibz-oofp-25-26.github.io/notreleased/&#34;&gt;class&lt;/a&gt;, and its values as simplistic &lt;a href=&#34;https://unibz-oofp-25-26.github.io/notreleased/&#34;&gt;objects&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;in-haskell&#34;&gt;&#xA;  in Haskell&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#in-haskell&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;!-- &lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;   --&gt;&#xA;&lt;!-- **_Syntax._** --&gt;&#xA;&lt;!-- Like an [enumerated type](), a product type in Haskell can be declared with the keyword `data`, as follows --&gt;&#xA;&lt;!----&gt;&#xA;&lt;!-- ``` --&gt;&#xA;&lt;!-- data &lt;product type name&gt; = &lt;definition&gt; --&gt;&#xA;&lt;!-- ``` --&gt;&#xA;&lt;!----&gt;&#xA;&lt;!-- &#xA;&lt;/blockquote&gt;&#xA; --&gt;&#xA;&lt;!-- There are two alternative syntaxes for this `&lt;definition&gt;`: --&gt;&#xA;&lt;!----&gt;&#xA;&lt;!-- - a [tuple type](), or --&gt;&#xA;&lt;!-- - a definition with a [constructor](). --&gt;&#xA;&lt;!-- ### Definition as a tuple type --&gt;&#xA;&lt;!----&gt;&#xA;&lt;!-- &lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;   --&gt;&#xA;&lt;!-- **_Example._** --&gt;&#xA;&lt;!-- The declaration below defines a product type `Interval`. --&gt;&#xA;&lt;!----&gt;&#xA;&lt;!-- ```haskell --&gt;&#xA;&lt;!-- -- a temporal interval, represented as two timestamps (start and end) --&gt;&#xA;&lt;!-- data Interval = (Int, Int) --&gt;&#xA;&lt;!-- ``` --&gt;&#xA;&lt;!----&gt;&#xA;&lt;!-- In this definition, `(Int, Int)` is the type of pairs of integers. --&gt;&#xA;&lt;!-- &#xA;&lt;/blockquote&gt;&#xA; --&gt;&#xA;&lt;!-- &lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;   --&gt;&#xA;&lt;!-- **_Example._** --&gt;&#xA;&lt;!-- The expression below define a product type `Signal`. --&gt;&#xA;&lt;!----&gt;&#xA;&lt;!-- A `Signal` consists of: --&gt;&#xA;&lt;!----&gt;&#xA;&lt;!-- - an `Interval`, and --&gt;&#xA;&lt;!-- - a value for the enumerated type `Light` seen [earlier](). --&gt;&#xA;&lt;!----&gt;&#xA;&lt;!-- ```haskell --&gt;&#xA;&lt;!-- -- a traffic signalling event, represented as a temporal interval and the light (Green, Yellow or Red) during that interval --&gt;&#xA;&lt;!-- data Signal = (Interval, Light) --&gt;&#xA;&lt;!-- ``` --&gt;&#xA;&lt;!----&gt;&#xA;&lt;!-- In this definition, `(Interval, Light)` is the type of all pairs with: --&gt;&#xA;&lt;!----&gt;&#xA;&lt;!-- - a first element of type `Interval`, and --&gt;&#xA;&lt;!-- - a second element of type `Light`. --&gt;&#xA;&lt;!----&gt;&#xA;&lt;!-- &#xA;&lt;/blockquote&gt;&#xA; --&gt;&#xA;&lt;!-- ### Instances --&gt;&#xA;&lt;!----&gt;&#xA;&lt;!-- &lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;   --&gt;&#xA;&lt;!-- **_Syntax (reminder)._** --&gt;&#xA;&lt;!-- A tuple in Haskell is written in parentheses. --&gt;&#xA;&lt;!-- &#xA;&lt;/blockquote&gt;&#xA; --&gt;&#xA;&lt;!----&gt;&#xA;&lt;!-- &lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;   --&gt;&#xA;&lt;!-- **_Examples._** --&gt;&#xA;&lt;!-- Consider the two product types that we just defined: --&gt;&#xA;&lt;!----&gt;&#xA;&lt;!-- ```haskell --&gt;&#xA;&lt;!-- data Interval = (Int, Int) --&gt;&#xA;&lt;!-- data Signal = (Interval, Light) --&gt;&#xA;&lt;!-- ``` --&gt;&#xA;&lt;!----&gt;&#xA;&lt;!-- Then: --&gt;&#xA;&lt;!----&gt;&#xA;&lt;!-- - the pair `(5,8)` has type `Interval`, --&gt;&#xA;&lt;!-- - the pair `((5,8), Red)` has type `Signal`. --&gt;&#xA;&lt;!----&gt;&#xA;&lt;!-- &#xA;&lt;/blockquote&gt;&#xA; --&gt;&#xA;&lt;!-- ### Definition with a constructor --&gt;&#xA;&lt;!-- Haskell provides another syntax to define a product type, by means of a **_constructor_**. --&gt;&#xA;&lt;!-- As we will see later, when combined with [sum types](), this syntax allows: --&gt;&#xA;&lt;!----&gt;&#xA;&lt;!-- - concise pattern matching, and --&gt;&#xA;&lt;!-- - [recursive types](). --&gt;&#xA;&lt;!----&gt;&#xA;&lt;!-- So this is often the _preferred way_ to define a product type. --&gt;&#xA;&lt;h3 id=&#34;declaration&#34;&gt;&#xA;  Declaration&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#declaration&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h3&gt;&#xA;&lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Syntax.&lt;/em&gt;&lt;/strong&gt;&#xA;A product type can be declared as&lt;/p&gt;</description>
    </item>
    <item>
      <title>Anonymous function</title>
      <link>https://unibz-oofp-25-26.github.io/docs/higher/sections/anonymous/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/higher/sections/anonymous/</guid>
      <description>&lt;h1 id=&#34;anonymous-function&#34;&gt;&#xA;  Anonymous function&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#anonymous-function&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;We have seen in the &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/background/sections/function/#anonymous&#34;&gt;dedicated section&lt;/a&gt; that a function can be written anonymously, as a lambda expression.&lt;/p&gt;&#xA;&lt;p&gt;Anonymous functions are a traditional feature of functional languages (like Haskell).&#xA;But they have also been integrated to a variety of imperative languages, for instance:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Python (since 1994),&lt;/li&gt;&#xA;&lt;li&gt;Javascript (since its initial release in 1995),&lt;/li&gt;&#xA;&lt;li&gt;C# (since 2007)&lt;/li&gt;&#xA;&lt;li&gt;C++ (since 2011)&lt;/li&gt;&#xA;&lt;li&gt;Java (since 2014)&lt;/li&gt;&#xA;&lt;li&gt;Rust (since its initial release in 2015)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;haskell&#34;&gt;&#xA;  In Haskell&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#haskell&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Syntax.&lt;/em&gt;&lt;/strong&gt;&#xA;&amp;ldquo;$\lambda x.$&amp;rdquo; in Haskell is written &lt;code&gt;\x -&amp;gt;&lt;/code&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Assignment 2</title>
      <link>https://unibz-oofp-25-26.github.io/docs/ass/sections/ass2/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/ass/sections/ass2/</guid>
      <description>&lt;h1 id=&#34;assignment-2-functional-patterns&#34;&gt;&#xA;  Assignment 2: functional patterns&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#assignment-2-functional-patterns&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;h2 id=&#34;exercise-1-utility-functions&#34;&gt;&#xA;  Exercise 1: utility functions&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#exercise-1-utility-functions&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;p&gt;Implement the functions below by completing the function stubs in the file &lt;code&gt;Src/Utility.hs&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Hint.&lt;/em&gt;&lt;/strong&gt;&#xA;Some of these functions can be used to implement others.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Hint.&lt;/em&gt;&lt;/strong&gt;&#xA;Feel free to create additional (auxiliary) functions to simplify your implementation.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;lastmatch&#34;&gt;&#xA;  &lt;code&gt;lastMatch&lt;/code&gt;&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#lastmatch&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h3&gt;&#xA;&lt;p&gt;Implement the function&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-haskell&#34; data-lang=&#34;haskell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;lastMatch&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt; (a &lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;Bool&lt;/span&gt;) &lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt; [a] &lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;Maybe&lt;/span&gt; a&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;such that &lt;code&gt;lastMatch f xs&lt;/code&gt; is:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;Just x&lt;/code&gt; if &lt;code&gt;x&lt;/code&gt; is the last element of the list &lt;code&gt;xs&lt;/code&gt; for which &lt;code&gt;f x&lt;/code&gt; is &lt;code&gt;True&lt;/code&gt;, or&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;Nothing&lt;/code&gt; if there is no such &lt;code&gt;x&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;For instance,&lt;/p&gt;</description>
    </item>
    <item>
      <title>Bound</title>
      <link>https://unibz-oofp-25-26.github.io/docs/generic/sections/bound/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/generic/sections/bound/</guid>
      <description>&lt;h1 id=&#34;bound&#34;&gt;&#xA;  Bound&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#bound&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;In some scenarios, a regular &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/generic/sections/variable/&#34;&gt;type variable&lt;/a&gt; may be too generic.&lt;/p&gt;&#xA;&lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Example.&lt;/em&gt;&lt;/strong&gt;&#xA;We may want to write an algorithm where the input can have any &lt;em&gt;numeric&lt;/em&gt; type (integer, float, etc.).&lt;/p&gt;&#xA;&lt;p&gt;A type variable in this case is too generic,&#xA;because it can also stand for a non-numeric type (e.g. string, Boolean value, a &lt;em&gt;function type&lt;/em&gt;, etc.).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;haskell&#34;&gt;&#xA;  In Haskell&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#haskell&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Example.&lt;/em&gt;&lt;/strong&gt;&#xA;The following function does &lt;em&gt;not&lt;/em&gt; compile, because the operation &lt;code&gt;+&lt;/code&gt; is not defined for arbitrary types.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Currying</title>
      <link>https://unibz-oofp-25-26.github.io/docs/higher/sections/currying/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/higher/sections/currying/</guid>
      <description>&lt;h1 id=&#34;currying&#34;&gt;&#xA;  Currying&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#currying&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;Functional programs traditionally define functions in &lt;em&gt;curried form&lt;/em&gt; (for a definition, we refer to the &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/background/sections/function/#currying&#34;&gt;dedicated section&lt;/a&gt;).&lt;/p&gt;&#xA;&lt;h2 id=&#34;haskell&#34;&gt;&#xA;  In Haskell&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#haskell&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;h3 id=&#34;syntax&#34;&gt;&#xA;  Syntax&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#syntax&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h3&gt;&#xA;&lt;p&gt;A Haskell function can (in theory) take a &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/haskell/sections/tuple/&#34;&gt;tuple&lt;/a&gt; as argument.&lt;/p&gt;&#xA;&lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Example.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-haskell&#34; data-lang=&#34;haskell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;power&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt; (&lt;span style=&#34;color:#66d9ef&#34;&gt;Int&lt;/span&gt;, &lt;span style=&#34;color:#66d9ef&#34;&gt;Int&lt;/span&gt;) &lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;Int&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;power&lt;/span&gt; (x,y) &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; x&lt;span style=&#34;color:#f92672&#34;&gt;^&lt;/span&gt;y&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/blockquote&gt;&#xA;&lt;p&gt;However, functions in &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/background/sections/function/#currying&#34;&gt;curried form&lt;/a&gt; are usually preferred, because they are more versatile.&lt;/p&gt;&#xA;&lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;&lt;em&gt;Example.&lt;/em&gt;&lt;/em&gt;&lt;/strong&gt; The function above in curried form can be written:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-haskell&#34; data-lang=&#34;haskell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;power&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;Int&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt; (&lt;span style=&#34;color:#66d9ef&#34;&gt;Int&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;Int&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;power&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;\&lt;/span&gt;x &lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt; (&lt;span style=&#34;color:#a6e22e&#34;&gt;\&lt;/span&gt;y &lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt; x&lt;span style=&#34;color:#f92672&#34;&gt;^&lt;/span&gt;y)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;or equivalently:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Function</title>
      <link>https://unibz-oofp-25-26.github.io/docs/background/sections/function/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/background/sections/function/</guid>
      <description>&lt;h1 id=&#34;function&#34;&gt;&#xA;  Function&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#function&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;&lt;p&gt;A &lt;strong&gt;function&lt;/strong&gt; $f\colon X \to Y$ maps each element $x$ of its &lt;strong&gt;domain&lt;/strong&gt; $X$ to an element $f(x)$ of its &lt;strong&gt;codomain&lt;/strong&gt; $Y$.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Terminology.&lt;/em&gt;&lt;/strong&gt;&#xA;A function is also called a &lt;strong&gt;map&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Examples.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$\ $the function $f\colon \mathbb{Z} \to \mathbb{N}$ defined by&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;$\qquad f(x) = x^2$&lt;/p&gt;&#xA;&lt;p&gt;$\qquad$maps each integer to its squared value.&lt;br&gt;&#xA;$\qquad$For instance,&lt;/p&gt;&#xA;&lt;p&gt;$\qquad f(3) = 9$&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;$\ $the function $g\colon \mathbb{N} \to \mathcal{P}(\mathbb{N})$ defined by&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;$\qquad g(x) = \{y \mid y \in \mathbb{N},\ y &amp;lt; x\}$&lt;/p&gt;</description>
    </item>
    <item>
      <title>Native functions</title>
      <link>https://unibz-oofp-25-26.github.io/docs/haskell/sections/native/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/haskell/sections/native/</guid>
      <description>&lt;h1 id=&#34;native-functions&#34;&gt;&#xA;  Native functions&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#native-functions&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Syntax.&lt;/em&gt;&lt;/strong&gt; Many native functions/operators (e.g. over numbers or Boolean values) have the same syntax in Haskell and Java.&#xA;This includes equality (&lt;code&gt;==&lt;/code&gt;), sum (&lt;code&gt;+&lt;/code&gt;), product (&lt;code&gt;*&lt;/code&gt;), etc.&lt;/p&gt;&#xA;&lt;p&gt;We highlight below a few cases where the two syntaxes differ:&lt;/p&gt;&#xA;&lt;table&gt;&#xA;  &lt;thead&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;th&gt;meaning&lt;/th&gt;&#xA;          &lt;th&gt;syntax in Haskell&lt;/th&gt;&#xA;          &lt;th&gt;example&lt;/th&gt;&#xA;          &lt;th&gt;syntax in Java&lt;/th&gt;&#xA;          &lt;th&gt;example&lt;/th&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/thead&gt;&#xA;  &lt;tbody&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;inequality&lt;/td&gt;&#xA;          &lt;td&gt;&lt;code&gt;/=&lt;/code&gt;&lt;/td&gt;&#xA;          &lt;td&gt;&lt;code&gt;x /= 2&lt;/code&gt;&lt;/td&gt;&#xA;          &lt;td&gt;&lt;code&gt;!=&lt;/code&gt;&lt;/td&gt;&#xA;          &lt;td&gt;&lt;code&gt;x != 2&lt;/code&gt;&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;negation (NOT)&lt;/td&gt;&#xA;          &lt;td&gt;&lt;code&gt;not&lt;/code&gt;&lt;/td&gt;&#xA;          &lt;td&gt;&lt;code&gt;not x&lt;/code&gt;&lt;/td&gt;&#xA;          &lt;td&gt;&lt;code&gt;!&lt;/code&gt;&lt;/td&gt;&#xA;          &lt;td&gt;&lt;code&gt;!x&lt;/code&gt;&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;disjunction (OR)&lt;/td&gt;&#xA;          &lt;td&gt;&lt;code&gt;||&lt;/code&gt;&lt;/td&gt;&#xA;          &lt;td&gt;&lt;code&gt;x || y&lt;/code&gt;&lt;/td&gt;&#xA;          &lt;td&gt;&lt;code&gt;||&lt;/code&gt; (lazy evaluation) or &lt;br&gt; &lt;code&gt;|&lt;/code&gt; (full evaluation)&lt;/td&gt;&#xA;          &lt;td&gt;&lt;code&gt;x || y&lt;/code&gt; or &lt;br&gt; &lt;code&gt;x | y&lt;/code&gt;&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;conjunction (AND)&lt;/td&gt;&#xA;          &lt;td&gt;&lt;code&gt;&amp;amp;&amp;amp;&lt;/code&gt;&lt;/td&gt;&#xA;          &lt;td&gt;&lt;code&gt;x &amp;amp;&amp;amp; y&lt;/code&gt;&lt;/td&gt;&#xA;          &lt;td&gt;&lt;code&gt;&amp;amp;&amp;amp;&lt;/code&gt; (lazy evaluation) or &lt;br&gt;&lt;code&gt;&amp;amp;&lt;/code&gt; (full evaluation)&lt;/td&gt;&#xA;          &lt;td&gt;&lt;code&gt;x &amp;amp;&amp;amp; y&lt;/code&gt; or &lt;br&gt; &lt;code&gt;x &amp;amp; y&lt;/code&gt;&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;/blockquote&gt;</description>
    </item>
    <item>
      <title>Reading path</title>
      <link>https://unibz-oofp-25-26.github.io/docs/intro/sections/reading_path/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/intro/sections/reading_path/</guid>
      <description>&lt;h1 id=&#34;reading-path&#34;&gt;&#xA;  Reading path&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#reading-path&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;This page lists the topics covered during each lecture.&#xA;It will be updated after a lecture.&lt;/p&gt;&#xA;&lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Advice.&lt;/em&gt;&lt;/strong&gt;&#xA;If you miss a lecture, make sure to read the sections that we covered (and do the related exercises) &lt;em&gt;before&lt;/em&gt; the next lecture.&#xA;Otherwise you may fall behind.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote class=&#34;book-hint danger&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Warning.&lt;/em&gt;&lt;/strong&gt;&#xA;On this website, the material is grouped in thematic chapters, to ease your revisions for the exam.&#xA;These chapters do &lt;em&gt;not&lt;/em&gt; always reflect the order of the lectures.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Sum type</title>
      <link>https://unibz-oofp-25-26.github.io/docs/composite/sections/sum/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/composite/sections/sum/</guid>
      <description>&lt;h1 id=&#34;sum-type&#34;&gt;&#xA;  Sum type&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#sum-type&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;A sum type represents several &lt;em&gt;alternative&lt;/em&gt; types.&lt;/p&gt;&#xA;&lt;h2 id=&#34;in-haskell&#34;&gt;&#xA;  in Haskell&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#in-haskell&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Syntax.&lt;/em&gt;&lt;/strong&gt;&#xA;A sum type in Haskell is declared as&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;data &amp;lt;sum type name&amp;gt; = &amp;lt;type 1&amp;gt; | ... | &amp;lt;type n&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;/blockquote&gt;&#xA;&lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Example.&lt;/em&gt;&lt;/strong&gt;&#xA;In the following declarations:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;Point&lt;/code&gt; is a &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/composite/sections/product/&#34;&gt;product type&lt;/a&gt;, and&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;Shape&lt;/code&gt; is a sum type.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-haskell&#34; data-lang=&#34;haskell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;-- a point in the Euclidean plane, represented by its coordinates&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;data&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;Point&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;PointC&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;Float&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;Float&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;-- a shape, defined as either a triangle or a rectangle&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;data&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;Shape&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;TriangleC&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;Point&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;Point&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;Point&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;|&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;RectangleC&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;Point&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;Point&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;Point&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;Point&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/blockquote&gt;&#xA;&lt;!-- &lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;   --&gt;&#xA;&lt;!-- **_Observation._** In this example, we use constructors (`TriangleC` and `RectangleC`) directly in the definition of the type `Shape`. --&gt;&#xA;&lt;!----&gt;&#xA;&lt;!-- Alternatively, we could have introduced names for the triangle and rectangle types, as follows: --&gt;&#xA;&lt;!----&gt;&#xA;&lt;!-- ```haskell --&gt;&#xA;&lt;!-- data Shape = Triangle | Rectangle --&gt;&#xA;&lt;!-- data Triangle = TriangleC Point Point Point --&gt;&#xA;&lt;!-- data Rectangle = RectangleC Point Point Point Point --&gt;&#xA;&lt;!-- ``` --&gt;&#xA;&lt;!----&gt;&#xA;&lt;!-- &#xA;&lt;/blockquote&gt;&#xA; --&gt;&#xA;&lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Note.&lt;/em&gt;&lt;/strong&gt;&#xA;in Haskell, an &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/composite/sections/enum/&#34;&gt;enumerated type&lt;/a&gt; is a sum type.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Typing</title>
      <link>https://unibz-oofp-25-26.github.io/docs/paradigm/sections/type/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/paradigm/sections/type/</guid>
      <description>&lt;h1 id=&#34;typing&#34;&gt;&#xA;  Typing&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#typing&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;A typing system restricts the values that can be used in certain contexts.&lt;/p&gt;&#xA;&lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Example.&lt;/em&gt;&lt;/strong&gt;&#xA;In Java, the following instruction is incorrect, because the variable &lt;code&gt;x&lt;/code&gt; has type &lt;code&gt;int&lt;/code&gt;, whereas the value &lt;code&gt;&amp;quot;Hi&amp;quot;&lt;/code&gt; is a string.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; x &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Hi&amp;#34;&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This line of code would generate a &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/paradigm/sections/error/&#34;&gt;compile-time error&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Terminology.&lt;/em&gt;&lt;/strong&gt;&#xA;In this example, &lt;code&gt;int&lt;/code&gt; is called a &lt;strong&gt;type annotation&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;static-vs-dynamic-typing&#34;&gt;&#xA;  Static vs dynamic typing&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#static-vs-dynamic-typing&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;h3 id=&#34;static&#34;&gt;&#xA;  Static typing&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#static&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h3&gt;&#xA;&lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Definition.&lt;/em&gt;&lt;/strong&gt;&#xA;A programming language is &lt;strong&gt;statically typed&lt;/strong&gt; if type checks are performed at compile time.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Accumulator and tail recursion</title>
      <link>https://unibz-oofp-25-26.github.io/docs/recursion/sections/accumulator/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/recursion/sections/accumulator/</guid>
      <description>&lt;h1 id=&#34;accumulator-and-tail-recursion&#34;&gt;&#xA;  Accumulator and tail recursion&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#accumulator-and-tail-recursion&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;h2 id=&#34;tail-recursion&#34;&gt;&#xA;  Tail recursion&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#tail-recursion&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Definition.&lt;/em&gt;&lt;/strong&gt;&#xA;A function/method is &lt;strong&gt;tail-recursive&lt;/strong&gt; if it is:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/recursion/sections/linear/&#34;&gt;linear recursive&lt;/a&gt;, and&lt;/li&gt;&#xA;&lt;li&gt;does not perform any operation after a recursive call.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Example.&lt;/em&gt;&lt;/strong&gt;&#xA;The following function is tail-recursive&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-haskell&#34; data-lang=&#34;haskell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;-- `True` iff the input string ends with an `s`&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;endsWithS&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;String&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;Bool&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;endsWithS&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;[]&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;False&lt;/span&gt;               &lt;span style=&#34;color:#75715e&#34;&gt;-- first base case&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;endsWithS&lt;/span&gt; [&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;s&amp;#39;&lt;/span&gt;] &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;True&lt;/span&gt;             &lt;span style=&#34;color:#75715e&#34;&gt;-- second base case&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;endsWithS&lt;/span&gt; (&lt;span style=&#34;color:#66d9ef&#34;&gt;_&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;:&lt;/span&gt; cs) &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; endsWithS cs  &lt;span style=&#34;color:#75715e&#34;&gt;-- inductive case&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/blockquote&gt;&#xA;&lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Example.&lt;/em&gt;&lt;/strong&gt;&#xA;The function &lt;code&gt;sum&lt;/code&gt; seen &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/recursion/sections/linear/&#34;&gt;earlier&lt;/a&gt; (and reproduced here) is &lt;em&gt;not&lt;/em&gt; tail-recursive, because the addition (Line 3) is performed &lt;em&gt;after&lt;/em&gt; termination of the recursive call.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Boolean condition</title>
      <link>https://unibz-oofp-25-26.github.io/docs/control/sections/condition/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/control/sections/condition/</guid>
      <description>&lt;h1 id=&#34;boolean-condition&#34;&gt;&#xA;  Boolean condition&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#boolean-condition&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/control/sections/pattern/&#34;&gt;Pattern matching&lt;/a&gt; has limitations.&lt;/p&gt;&#xA;&lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Examples.&lt;/em&gt;&lt;/strong&gt;&#xA;No pattern can match:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;integers greater than 2,&lt;/li&gt;&#xA;&lt;li&gt;odd integers,&lt;/li&gt;&#xA;&lt;li&gt;etc.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;For more expressive conditions, programming language usually rely on Boolean expressions.&lt;/p&gt;&#xA;&lt;h2 id=&#34;haskell&#34;&gt;&#xA;  In Haskell&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#haskell&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;h3 id=&#34;boolean-expression&#34;&gt;&#xA;  Boolean expression&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#boolean-expression&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h3&gt;&#xA;&lt;p&gt;We have seen how to define a Boolean operator (precisely, the Boolean operator &amp;ldquo;AND&amp;rdquo;) &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/control/sections/pattern/&#34;&gt;with patterns&lt;/a&gt; in Haskell.&lt;/p&gt;&#xA;&lt;p&gt;This is not necessary: Haskell provides native implementations, similar to their counterparts in Java (and many programming languages).&#xA;They include:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Evaluation</title>
      <link>https://unibz-oofp-25-26.github.io/docs/intro/sections/evaluation/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/intro/sections/evaluation/</guid>
      <description>&lt;h1 id=&#34;evaluation&#34;&gt;&#xA;  Evaluation&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#evaluation&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;Evaluation for this course is based on:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;a &lt;a href=&#34;#exam&#34;&gt;written exam&lt;/a&gt;, and&lt;/li&gt;&#xA;&lt;li&gt;5 to 6 &lt;a href=&#34;#assignments&#34;&gt;assignments&lt;/a&gt; with oral presentations.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The assignments are &lt;em&gt;optional&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;scheme&#34;&gt;&#xA;  Marking scheme&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#scheme&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;p&gt;An assignment counts &lt;em&gt;only if&lt;/em&gt; your mark for this assignment is superior to your mark at the written exam.&lt;br&gt;&#xA;If this is the case, then the assignment counts for 5% of your final mark.&lt;/p&gt;&#xA;&lt;div class=&#34;book-columns flex flex-wrap&#34;&gt;&#xA;&lt;div class=&#34;flex-even markdown-inner&#34; style=&#34;flex-grow: 3;&#34;&gt;&#xA;&lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;  &lt;p&gt;&lt;strong&gt;&lt;em&gt;Example.&lt;/em&gt;&lt;/strong&gt;&#xA;For the marks reported on the right:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Pipeline</title>
      <link>https://unibz-oofp-25-26.github.io/docs/pattern/sections/pipe/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/pattern/sections/pipe/</guid>
      <description>&lt;h1 id=&#34;pipeline&#34;&gt;&#xA;  Pipeline&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#pipeline&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;We will see in this section how functional languages provide a convenient syntax to &lt;em&gt;compose&lt;/em&gt; functions that modify lists.&lt;/p&gt;&#xA;&lt;p&gt;This lets us apply a sequence of operations (filter, transform, aggregate, etc.) to a stream of incoming data,&#xA;analogously to &lt;a href=&#34;https://en.wikipedia.org/wiki/Pipeline_%28Unix%29&#34;&gt;Unix-like pipes&lt;/a&gt;.&#xA;This style of programming also pairs well with &lt;a href=&#34;https://unibz-oofp-25-26.github.io/notreleased/&#34;&gt;functors&lt;/a&gt; and &lt;a href=&#34;https://unibz-oofp-25-26.github.io/notreleased/&#34;&gt;monads&lt;/a&gt;, which we will see in later sections.&lt;/p&gt;&#xA;&lt;p&gt;Thanks to &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/control/#lazy&#34;&gt;lazy evaluation&lt;/a&gt;, each operation in the pipeline can start feeding partial results to the next one, even if it has not finished processing its input list.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Prerequisites</title>
      <link>https://unibz-oofp-25-26.github.io/docs/intro/sections/prerequisites/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/intro/sections/prerequisites/</guid>
      <description>&lt;h1 id=&#34;prerequisites&#34;&gt;&#xA;  Prerequisites&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#prerequisites&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;Students are expected to have completed the &lt;em&gt;Computer Programming&lt;/em&gt; course (INF/01 76203).&lt;/p&gt;&#xA;&lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Consequence.&lt;/em&gt;&lt;/strong&gt;&#xA;The following topics are &lt;em&gt;not&lt;/em&gt; covered in this course:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;variables, assignments, variable scope,&lt;/li&gt;&#xA;&lt;li&gt;basic data types (&lt;code&gt;int&lt;/code&gt;, &lt;code&gt;char&lt;/code&gt;, &lt;code&gt;boolean&lt;/code&gt;, etc.).&lt;/li&gt;&#xA;&lt;li&gt;expression evaluation,&lt;/li&gt;&#xA;&lt;li&gt;conditional statements (&amp;ldquo;if/then/else&amp;rdquo;) and loops,&lt;/li&gt;&#xA;&lt;li&gt;methods/functions,&lt;/li&gt;&#xA;&lt;li&gt;arrays,&lt;/li&gt;&#xA;&lt;li&gt;basic syntax of Java,&lt;/li&gt;&#xA;&lt;li&gt;etc.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Hint.&lt;/em&gt;&lt;/strong&gt;&#xA;If you have not completed this course, you can ask for &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/intro/sections/office_hours/&#34;&gt;office hours&lt;/a&gt; to get help on these topics.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Pure function</title>
      <link>https://unibz-oofp-25-26.github.io/docs/paradigm/sections/pure/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/paradigm/sections/pure/</guid>
      <description>&lt;h1 id=&#34;pure-function&#34;&gt;&#xA;  Pure function&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#pure-function&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;Functional languages like Haskell favor &lt;strong&gt;pure functions&lt;/strong&gt;, which behave like &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/background/sections/function/&#34;&gt;mathematical functions&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In imperative code, their adoption varies by language and community.&#xA;For instance, pure functions are not idiomatic in C, but common in languages like Java, JavaScript, Python or Rust.&lt;/p&gt;&#xA;&lt;h2 id=&#34;side-effect&#34;&gt;&#xA;  Side effect&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#side-effect&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Definition.&lt;/em&gt;&lt;/strong&gt;&#xA;A method/function has a &lt;strong&gt;side effect&lt;/strong&gt; if it modifies a resource (variable, object, array, etc.) that is defined outside of its scope.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Tuple</title>
      <link>https://unibz-oofp-25-26.github.io/docs/haskell/sections/tuple/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/haskell/sections/tuple/</guid>
      <description>&lt;h1 id=&#34;tuple&#34;&gt;&#xA;  Tuple&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#tuple&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;Syntax.&lt;/strong&gt;&#xA;A &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/background/sections/set_list/#tuple&#34;&gt;tuple&lt;/a&gt; in Haskell is written in parentheses.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Example.&lt;/em&gt;&lt;/strong&gt;&#xA;The &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/background/sections/set_list/#tuple&#34;&gt;pair&lt;/a&gt;&#xA;$(\mathit{banana}, 5)$ is written&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-haskell&#34; data-lang=&#34;haskell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;banana&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#ae81ff&#34;&gt;5&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/blockquote&gt;&#xA;&lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;Syntax.&lt;/strong&gt; The &lt;em&gt;type&lt;/em&gt; of a tuple is written in parentheses (like the tuple itself).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Examples.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;table&gt;&#xA;  &lt;thead&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;th&gt;Haskell tuple&lt;/th&gt;&#xA;          &lt;th&gt;Possible type&lt;/th&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/thead&gt;&#xA;  &lt;tbody&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;&lt;code&gt;(5,3)&lt;/code&gt;&lt;/td&gt;&#xA;          &lt;td&gt;&lt;code&gt;(Int, Int)&lt;/code&gt;&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;&lt;code&gt;(&amp;quot;banana&amp;quot;, 5)&lt;/code&gt;&lt;/td&gt;&#xA;          &lt;td&gt;&lt;code&gt;(String, Int)&lt;/code&gt;&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;&lt;code&gt;(&amp;quot;banana&amp;quot;, 5, &amp;quot;tomato&amp;quot;)&lt;/code&gt;&lt;/td&gt;&#xA;          &lt;td&gt;&lt;code&gt;(String, Int, String)&lt;/code&gt;&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;/blockquote&gt;</description>
    </item>
    <item>
      <title>Function</title>
      <link>https://unibz-oofp-25-26.github.io/docs/haskell/sections/function/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/haskell/sections/function/</guid>
      <description>&lt;h1 id=&#34;function&#34;&gt;&#xA;  Function&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#function&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;h2 id=&#34;definition&#34;&gt;&#xA;  Function definition&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#definition&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Syntax.&lt;/em&gt;&lt;/strong&gt;&#xA;A function in Haskell is defined analogously to a &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/background/sections/function/&#34;&gt;mathematical function&lt;/a&gt;, with the symbol &lt;code&gt;=&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Example.&lt;/em&gt;&lt;/strong&gt;&#xA;The function $f(x) = 2x$ is written:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-haskell&#34; data-lang=&#34;haskell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;f&lt;/span&gt; x &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt; x&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/blockquote&gt;&#xA;&lt;blockquote class=&#34;book-hint danger&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Warning.&lt;/em&gt;&lt;/strong&gt;&#xA;As opposed to Java (and C/C++, C#, Javascript, Python, etc.), the symbol &lt;code&gt;=&lt;/code&gt; in Haskell does &lt;em&gt;not&lt;/em&gt; assign a value to a variable.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;Syntax.&lt;/strong&gt;&#xA;Note that $f(x)$ is written &lt;code&gt;f x&lt;/code&gt;, without parentheses.&#xA;This also holds when applying a function to a constant.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Functor</title>
      <link>https://unibz-oofp-25-26.github.io/docs/pattern/sections/functor/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/pattern/sections/functor/</guid>
      <description>&lt;h1 id=&#34;functor&#34;&gt;&#xA;  Functor&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#functor&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;The notion of functor comes from a branch of mathematics called &lt;a href=&#34;https://en.wikipedia.org/wiki/Category_theory&#34;&gt;category theory&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;For programmers, a functor can be viewed as a &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/generic/sections/generic_type/&#34;&gt;generic type&lt;/a&gt; that implements a certain function (called &lt;code&gt;fmap&lt;/code&gt; in Haskell), while respecting certain &lt;a href=&#34;#constraints&#34;&gt;constraints&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;haskell&#34;&gt;&#xA;  In Haskell&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#haskell&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Definition.&lt;/em&gt;&lt;/strong&gt;&#xA;&lt;code&gt;Functor&lt;/code&gt; in Haskell is a &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/generic/sections/bound/#class&#34;&gt;type class&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;A type &lt;code&gt;t&lt;/code&gt; that belongs to this class must:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;be a &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/generic/sections/generic_type/&#34;&gt;generic type&lt;/a&gt; (with a single type variable), and&lt;/li&gt;&#xA;&lt;li&gt;implement the function&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-haskell&#34; data-lang=&#34;haskell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;fmap&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;::&lt;/span&gt; (&lt;span style=&#34;color:#66d9ef&#34;&gt;Functor&lt;/span&gt; t) &lt;span style=&#34;color:#f92672&#34;&gt;=&amp;gt;&lt;/span&gt; (a &lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt; b) &lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt; t a &lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt; t b&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/blockquote&gt;&#xA;&lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Terminology.&lt;/em&gt;&lt;/strong&gt;&#xA;The function &lt;code&gt;fmap&lt;/code&gt; &lt;strong&gt;lifts&lt;/strong&gt; a function&lt;/p&gt;</description>
    </item>
    <item>
      <title>Generic type</title>
      <link>https://unibz-oofp-25-26.github.io/docs/generic/sections/generic_type/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/generic/sections/generic_type/</guid>
      <description>&lt;h1 id=&#34;generic-type&#34;&gt;&#xA;  Generic type&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#generic-type&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;h2 id=&#34;in-haskell&#34;&gt;&#xA;  In Haskell&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#in-haskell&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;h3 id=&#34;syntax&#34;&gt;&#xA;  Syntax&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#syntax&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h3&gt;&#xA;&lt;p&gt;We have already seen how to define a &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/composite/sections/product/&#34;&gt;product type&lt;/a&gt; or a &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/composite/sections/sum/&#34;&gt;sum type&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Example.&lt;/em&gt;&lt;/strong&gt;&#xA;As we have seen &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/composite/sections/sum/#recursive&#34;&gt;earlier&lt;/a&gt;, the type of &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/haskell/sections/list/&#34;&gt;lists&lt;/a&gt; of integers can be defined as follows:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-haskell&#34; data-lang=&#34;haskell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;data&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;IntList&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;Nil&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;|&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;Cons&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;Int&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;IntList&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Similarly, the type of lists of Booleans can be defined as&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-haskell&#34; data-lang=&#34;haskell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;data&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;BoolList&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;Nil&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;|&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;Cons&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;Bool&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;BoolList&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To make this more generic, we can use a &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/generic/sections/variable/&#34;&gt;type variable&lt;/a&gt; instead of the concrete type (&lt;code&gt;Int&lt;/code&gt; or &lt;code&gt;Bool&lt;/code&gt; here).&lt;/p&gt;</description>
    </item>
    <item>
      <title>Monad</title>
      <link>https://unibz-oofp-25-26.github.io/docs/pattern/sections/monad/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/pattern/sections/monad/</guid>
      <description>&lt;h1 id=&#34;monad&#34;&gt;&#xA;  Monad&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#monad&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;Like &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/pattern/sections/functor/&#34;&gt;functors&lt;/a&gt;, monads come from category theory.&lt;/p&gt;&#xA;&lt;p&gt;For programmers, a monad can be viewed as a functor that implements additional functions, while respecting certain constraints.&lt;/p&gt;&#xA;&lt;p&gt;Monads serve a variety of purposes in functional programs.&#xA;This includes (among other) writing to a log, or reading data.&lt;/p&gt;&#xA;&lt;p&gt;In this section, we will only focus on two of the simplest monads, namely the type of lists and the option type (as we did for functors).&lt;/p&gt;</description>
    </item>
    <item>
      <title>Office hours</title>
      <link>https://unibz-oofp-25-26.github.io/docs/intro/sections/office_hours/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/intro/sections/office_hours/</guid>
      <description>&lt;h1 id=&#34;office-hours&#34;&gt;&#xA;  Office hours&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#office-hours&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;You can ask for office hours to get help with:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/intro/sections/prerequisites/&#34;&gt;prerequisites&lt;/a&gt; for this course,&lt;/li&gt;&#xA;&lt;li&gt;an &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/intro/sections/evaluation/#assignments&#34;&gt;assignment&lt;/a&gt;,&lt;/li&gt;&#xA;&lt;li&gt;a notion seen during a lecture,&lt;/li&gt;&#xA;&lt;li&gt;etc.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;These appointments must be scheduled via email or Teams.&lt;/p&gt;&#xA;&lt;h2 id=&#34;additional-content&#34;&gt;&#xA;  Additional content&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#additional-content&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;p&gt;Office hours can also be organized on demand for a group of students, on any of the following topics:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;hierarchical file system,&lt;/li&gt;&#xA;&lt;li&gt;git,&lt;/li&gt;&#xA;&lt;li&gt;using a terminal,&lt;/li&gt;&#xA;&lt;li&gt;text editors and IDEs (landscape and usage).&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;&lt;p&gt;This content is &lt;em&gt;optional&lt;/em&gt;.&#xA;It is meant to help you interact with a computer,&#xA;so that your learning experience does not get impaired by technological obstacles.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Content</title>
      <link>https://unibz-oofp-25-26.github.io/docs/intro/sections/content/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/intro/sections/content/</guid>
      <description>&lt;h1 id=&#34;content-of-the-course&#34;&gt;&#xA;  Content of the course&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#content-of-the-course&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;&lt;p&gt;This is a programming course for &lt;em&gt;beginners&lt;/em&gt;, with an emphasis on:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;(class-based) &lt;strong&gt;object-oriented&lt;/strong&gt; programming and&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;functional&lt;/strong&gt; programming.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;h2 id=&#34;programming-languages&#34;&gt;&#xA;  Programming languages&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#programming-languages&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;p&gt;We will use:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Haskell at the beginning of this course, for a &lt;em&gt;short introduction&lt;/em&gt; to functional programming, and&lt;/li&gt;&#xA;&lt;li&gt;Java during the rest of the course, for object-oriented and more general techniques.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Note.&lt;/em&gt;&lt;/strong&gt; Many notions seen in this course are &lt;em&gt;not&lt;/em&gt; specific to Haskell or Java.&#xA;Accordingly, some sections may use &lt;a href=&#34;https://en.wikipedia.org/wiki/Pseudocode&#34;&gt;pseudocode&lt;/a&gt; for conciseness.&lt;/p&gt;</description>
    </item>
    <item>
      <title>List comprehension</title>
      <link>https://unibz-oofp-25-26.github.io/docs/control/sections/comprehension/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/control/sections/comprehension/</guid>
      <description>&lt;h1 id=&#34;list-comprehension&#34;&gt;&#xA;  List comprehension&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#list-comprehension&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;Pure functional programming does not admit loops.&lt;/p&gt;&#xA;&lt;p&gt;In particular, this is the case of Haskell.&#xA;So iteration in Haskell is primarily achieved via &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/recursion/&#34;&gt;recursive functions&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Besides, Haskell provides an alternative syntax for a &lt;em&gt;limited&lt;/em&gt; form of iteration, called &lt;strong&gt;list comprehensions&lt;/strong&gt;.&lt;br&gt;&lt;/p&gt;&#xA;&lt;p&gt;List comprehensions are also available in Python (with a slightly different syntax) since the release of Python 2 (in 2000).&lt;/p&gt;&#xA;&lt;h2 id=&#34;syntax&#34;&gt;&#xA;  Syntax&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#syntax&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;p&gt;We have already seen &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/background/sections/set_list/#comprehension&#34;&gt;set comprehensions&lt;/a&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Option type</title>
      <link>https://unibz-oofp-25-26.github.io/docs/generic/sections/maybe/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/generic/sections/maybe/</guid>
      <description>&lt;h1 id=&#34;option-type&#34;&gt;&#xA;  Option type&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#option-type&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;We introduce an important &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/generic/sections/generic_type/&#34;&gt;generic&lt;/a&gt; &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/composite/sections/sum/&#34;&gt;sum type&lt;/a&gt;, available in many languages, under a variety of names (&lt;code&gt;Maybe&lt;/code&gt;, &lt;code&gt;Option&lt;/code&gt;, &lt;code&gt;optional&lt;/code&gt;, &lt;code&gt;Optional&lt;/code&gt;, &lt;code&gt;Nullable&lt;/code&gt;, etc.)&lt;/p&gt;&#xA;&lt;p&gt;We will see in the dedicated sections that such a type can also be made a &lt;a href=&#34;https://unibz-oofp-25-26.github.io/notreleased/&#34;&gt;functor&lt;/a&gt;, and (perhaps most importantly) a &lt;a href=&#34;https://unibz-oofp-25-26.github.io/notreleased/&#34;&gt;monad&lt;/a&gt;.&#xA;For now, we will use it without these extra features.&lt;/p&gt;&#xA;&lt;h2 id=&#34;motivation&#34;&gt;&#xA;  Motivation&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#motivation&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;blockquote class=&#34;book-hint danger&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Problem.&lt;/em&gt;&lt;/strong&gt;&#xA;A programming language may not have a type that exactly fits the &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/background/sections/function/&#34;&gt;domain&lt;/a&gt; of a function that we want to implement.&lt;/p&gt;</description>
    </item>
    <item>
      <title>A few higher-order functions</title>
      <link>https://unibz-oofp-25-26.github.io/docs/higher/sections/useful_hofs/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/higher/sections/useful_hofs/</guid>
      <description>&lt;h1 id=&#34;a-few-higher-order-functions&#34;&gt;&#xA;  A few higher-order functions&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#a-few-higher-order-functions&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;p&gt;We introduce a few convenient higher-order functions.&lt;/p&gt;&#xA;&lt;h2 id=&#34;haskell&#34;&gt;&#xA;  In Haskell&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#haskell&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;!-- ### `uncurry` --&gt;&#xA;&lt;!----&gt;&#xA;&lt;!-- &lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;   --&gt;&#xA;&lt;!-- The function --&gt;&#xA;&lt;!----&gt;&#xA;&lt;!-- ```haskell --&gt;&#xA;&lt;!-- uncurry :: (a -&gt; b -&gt; c) -&gt; (a, b) -&gt; c --&gt;&#xA;&lt;!-- ``` --&gt;&#xA;&lt;!----&gt;&#xA;&lt;!-- maps a curried function (with type `a -&gt; b -&gt; c`) into its uncurried form (with type `(a, b) -&gt; c`). --&gt;&#xA;&lt;!-- &#xA;&lt;/blockquote&gt;&#xA; --&gt;&#xA;&lt;!----&gt;&#xA;&lt;!-- &lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;   --&gt;&#xA;&lt;!-- **_Example._** --&gt;&#xA;&lt;!-- Consider the native function --&gt;&#xA;&lt;!----&gt;&#xA;&lt;!-- ```haskell --&gt;&#xA;&lt;!-- min :: Ord a =&gt; a -&gt; a -&gt; a --&gt;&#xA;&lt;!-- ``` --&gt;&#xA;&lt;!----&gt;&#xA;&lt;!-- where --&gt;&#xA;&lt;!----&gt;&#xA;&lt;!-- ```haskell --&gt;&#xA;&lt;!-- min x y --&gt;&#xA;&lt;!-- ``` --&gt;&#xA;&lt;!----&gt;&#xA;&lt;!-- is the smaller out of `x` and `y`.&lt;br&gt; --&gt;&#xA;&lt;!-- Then --&gt;&#xA;&lt;!----&gt;&#xA;&lt;!-- ```haskell --&gt;&#xA;&lt;!-- uncurry min (x,y) --&gt;&#xA;&lt;!-- ``` --&gt;&#xA;&lt;!----&gt;&#xA;&lt;!-- is the smaller out of `x` and `y`. --&gt;&#xA;&lt;!----&gt;&#xA;&lt;!-- &#xA;&lt;/blockquote&gt;&#xA; --&gt;&#xA;&lt;h3 id=&#34;filter&#34;&gt;&#xA;  &lt;code&gt;filter&lt;/code&gt;&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#filter&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h3&gt;&#xA;&lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;&lt;p&gt;The function &lt;code&gt;filter&lt;/code&gt; retains elements of a list that satisfy a certain condition.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Program</title>
      <link>https://unibz-oofp-25-26.github.io/docs/haskell/sections/program/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/haskell/sections/program/</guid>
      <description>&lt;h1 id=&#34;program&#34;&gt;&#xA;  Program&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#program&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;h2 id=&#34;file&#34;&gt;&#xA;  File&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#file&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;p&gt;A simple Haskell program is written in a file with the extension &lt;code&gt;.hs&lt;/code&gt;.&#xA;For instance, &lt;code&gt;MyProgram.hs&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;content&#34;&gt;&#xA;  Content&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#content&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;h3 id=&#34;functions&#34;&gt;&#xA;  Functions&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#functions&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h3&gt;&#xA;&lt;p&gt;A Haskell program primarily consists of &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/haskell/sections/function/#definition&#34;&gt;function definitions&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Hint.&lt;/em&gt;&lt;/strong&gt;&#xA;The order of function definitions in a program is irrelevant.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;h4 id=&#34;main&#34;&gt;&#xA;  The function &lt;code&gt;main&lt;/code&gt;&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#main&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h4&gt;&#xA;&lt;p&gt;To make a program executable, one of its functions must be the entry point.&#xA;By default, this function is called &lt;code&gt;main&lt;/code&gt;, and has type &lt;code&gt;IO ()&lt;/code&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Call stack</title>
      <link>https://unibz-oofp-25-26.github.io/docs/control/sections/stack/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/control/sections/stack/</guid>
      <description>&lt;h1 id=&#34;call-stack&#34;&gt;&#xA;  Call stack&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#call-stack&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;&lt;p&gt;During the execution of a program, the &lt;strong&gt;call stack&lt;/strong&gt; keeps track of ongoing function/method calls:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;when a function/method is called, a &lt;strong&gt;frame&lt;/strong&gt; is &lt;a href=&#34;https://unibz-oofp-25-26.github.io/notreleased/&#34;&gt;pushed&lt;/a&gt; on top of the stack:&#xA;the frame stores information about the execution of the function/method (current value of variables, &amp;hellip;),&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;when the execution of the call terminates, the frame is &lt;a href=&#34;https://unibz-oofp-25-26.github.io/notreleased/&#34;&gt;popped&lt;/a&gt; from the stack,&#xA;and control is passed back to the calling function/method (whose frame is now on top of the stack).&lt;/p&gt;</description>
    </item>
    <item>
      <title>Additional resources</title>
      <link>https://unibz-oofp-25-26.github.io/docs/intro/sections/resources/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/intro/sections/resources/</guid>
      <description>&lt;h1 id=&#34;additional-resources&#34;&gt;&#xA;  Additional resources&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#additional-resources&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;&lt;p&gt;This course is self-contained, meaning that &lt;em&gt;no&lt;/em&gt; extra reading is required.&lt;br&gt;&#xA;We list here &lt;em&gt;optional&lt;/em&gt; resources that may help you complement it, or provide a different perspective.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;A &lt;a href=&#34;https://eu.alma.exlibrisgroup.com/leganto/public/39UBZ_INST/lists/37611243460001241?auth=SAML&#34;&gt;reading list&lt;/a&gt; for this course is available in the catalogue of the Unibz&amp;rsquo;s library.&#xA;All books can be accessed via the library (either physically or digitally).&lt;/p&gt;&#xA;&lt;p&gt;Among these books, we highlight the following five.&lt;/p&gt;&#xA;&lt;h2 id=&#34;introductory-textbooks&#34;&gt;&#xA;  Introductory textbooks&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#introductory-textbooks&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;h3 id=&#34;java&#34;&gt;&#xA;  Java&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#java&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h3&gt;&#xA;&lt;div class=&#34;book-columns flex flex-wrap&#34;&gt;&#xA;&lt;div class=&#34;flex-even markdown-inner&#34; style=&#34;flex-grow: 1;&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;Java : the complete reference (11th edition)&lt;/strong&gt;&#xA;by Herbert Schildt&#xA;McGraw-Hill Education, 2019&lt;/p&gt;</description>
    </item>
    <item>
      <title>List</title>
      <link>https://unibz-oofp-25-26.github.io/docs/haskell/sections/list/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/haskell/sections/list/</guid>
      <description>&lt;h1 id=&#34;list&#34;&gt;&#xA;  List&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#list&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;h2 id=&#34;recursive-form&#34;&gt;&#xA;  Recursive form&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#recursive-form&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;p&gt;Lists in Haskell are recursive.&lt;/p&gt;&#xA;&lt;blockquote class=&#34;book-hint warning&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Definition (finite list in Haskell).&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;[]&lt;/code&gt; is the empty list,&lt;/li&gt;&#xA;&lt;li&gt;if &lt;code&gt;x&lt;/code&gt; is an element and &lt;code&gt;xs&lt;/code&gt; a list, then &lt;code&gt;x : xs&lt;/code&gt; is a list.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;In addition, all elements in a list must have the same type.&#xA;If this type is &lt;code&gt;a&lt;/code&gt;, then the list has type &lt;code&gt;[a]&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote class=&#34;book-hint info&#34;&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Example.&lt;/em&gt;&lt;/strong&gt;&#xA;The Haskell list&lt;/p&gt;&#xA;&lt;p&gt;$\qquad$&lt;code&gt;5 : (2 : [])&lt;/code&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Software</title>
      <link>https://unibz-oofp-25-26.github.io/docs/intro/sections/software/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/docs/intro/sections/software/</guid>
      <description>&lt;h1 id=&#34;recommended-software&#34;&gt;&#xA;  Recommended software&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#recommended-software&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h1&gt;&#xA;&lt;h2 id=&#34;lectures&#34;&gt;&#xA;  Lectures&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#lectures&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;p&gt;No particular software is required for the lectures.&lt;/p&gt;&#xA;&lt;p&gt;The exercises can be solved using web applications, for instance:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;the &lt;a href=&#34;https://play.haskell.org/&#34;&gt;Haskell playground&lt;/a&gt; and&lt;/li&gt;&#xA;&lt;li&gt;the &lt;a href=&#34;https://dev.java/playground/&#34;&gt;Java playground&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;However, a proper code editor may be more comfortable.&lt;/p&gt;&#xA;&lt;h2 id=&#34;assignments&#34;&gt;&#xA;  Assignments&#xA;  &lt;a class=&#34;anchor&#34; href=&#34;#assignments&#34;&gt;#&lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;p&gt;For the assignments, you will need an IDE for Haskell and Java (possibly the same one).&#xA;We provide detailed instructions &lt;a href=&#34;#install&#34;&gt;below&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Before these, we briefly explain what a package manager is, why it can be useful, and how to install and use one.&lt;/p&gt;</description>
    </item>
    <item>
      <title></title>
      <link>https://unibz-oofp-25-26.github.io/notreleased/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://unibz-oofp-25-26.github.io/notreleased/</guid>
      <description>&lt;p&gt;This page will be released after the dedicated &lt;a href=&#34;https://unibz-oofp-25-26.github.io/docs/intro/sections/reading_path/&#34;&gt;lecture&lt;/a&gt;.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
