<?xml version="1.0" encoding="utf-8"?>
<!-- generator="FeedCreator 1.7.2-ppt DokuWiki" -->
<?xml-stylesheet href="https://ocw.cs.pub.ro/ppcarte/lib/exe/css.php?s=feed" type="text/css"?>
<rdf:RDF
    xmlns="http://purl.org/rss/1.0/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
    xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel rdf:about="https://ocw.cs.pub.ro/ppcarte/feed.php">
        <title>books pp</title>
        <description></description>
        <link>https://ocw.cs.pub.ro/ppcarte/</link>
        <image rdf:resource="https://ocw.cs.pub.ro/ppcarte/lib/tpl/bootstrap3/images/favicon.ico" />
       <dc:date>2026-04-25T14:45:15+03:00</dc:date>
        <items>
            <rdf:Seq>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:2021-demo&amp;rev=1622714714&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:adt&amp;rev=1490004966&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:c06&amp;rev=1493024928&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:c07&amp;rev=1493025684&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:c08&amp;rev=1523291383&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:c09&amp;rev=1494479690&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:class&amp;rev=1618168558&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:exam2022&amp;rev=1653647120&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:examen2021&amp;rev=1621513768&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:examen2022&amp;rev=1653561176&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:functors&amp;rev=1619009473&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:h01&amp;rev=1522320746&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:haskell-environment&amp;rev=1550246808&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:high&amp;rev=1616307295&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:hoogle&amp;rev=1555069782&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:intro&amp;rev=1550161149&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l01&amp;rev=1586261126&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l02&amp;rev=1615915489&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l03&amp;rev=1647782004&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l04&amp;rev=1679504069&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l04x&amp;rev=1617623499&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l04xx&amp;rev=1586261477&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l05&amp;rev=1580910611&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l05x&amp;rev=1586261503&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l06&amp;rev=1580910651&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l07&amp;rev=1557132068&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l08&amp;rev=1586720055&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l09&amp;rev=1587832308&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l10&amp;rev=1621946682&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l11&amp;rev=1589888571&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l12&amp;rev=1589482560&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l112021&amp;rev=1622368665&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lab_solutions&amp;rev=1551982201&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lambda&amp;rev=1554748417&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lazylab&amp;rev=1619360442&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lecture01&amp;rev=1646302352&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lecture03&amp;rev=1647360263&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lecture05&amp;rev=1647512584&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lecture07&amp;rev=1648453442&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lecture08&amp;rev=1648569543&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lecture09&amp;rev=1648746745&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lecture12&amp;rev=1650361818&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lecture13&amp;rev=1650361886&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lecture15&amp;rev=1651763056&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lecture16&amp;rev=1652195122&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lecture18&amp;rev=1653561427&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lheap&amp;rev=1555586628&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:llambdacalc&amp;rev=1580910633&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lplcut&amp;rev=1557142249&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lplprobs&amp;rev=1580910726&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:main&amp;rev=1488115002&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:other-exercises&amp;rev=1616307273&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:plagiarism&amp;rev=1614927331&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:polymorphism&amp;rev=1523970365&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:project2021&amp;rev=1652283921&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:reading&amp;rev=1580910209&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:rec&amp;rev=1550439736&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:rules&amp;rev=1646029928&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:scala-environment&amp;rev=1772094973&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:scala-project&amp;rev=1641981501&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:scalalab1&amp;rev=1651933589&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:scalalab2&amp;rev=1652908605&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:scalalab3&amp;rev=1653430554&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:syntax&amp;rev=1584047882&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:tailend&amp;rev=1462463205&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:team&amp;rev=1615292461&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:test1_page&amp;rev=1491334526&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:test_lab2&amp;rev=1520172130&amp;do=diff"/>
                <rdf:li rdf:resource="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:types&amp;rev=1489399460&amp;do=diff"/>
            </rdf:Seq>
        </items>
    </channel>
    <image rdf:about="https://ocw.cs.pub.ro/ppcarte/lib/tpl/bootstrap3/images/favicon.ico">
        <title>books</title>
        <link>https://ocw.cs.pub.ro/ppcarte/</link>
        <url>https://ocw.cs.pub.ro/ppcarte/lib/tpl/bootstrap3/images/favicon.ico</url>
    </image>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:2021-demo&amp;rev=1622714714&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-06-03T13:05:14+03:00</dc:date>
        <title>pp:2021-demo</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:2021-demo&amp;rev=1622714714&amp;do=diff</link>
        <description>Examen PP

(L/P) Reduceti urmatoarea lambda-expresie folosind strategiile normala si aplicativa.


(λx.(x x) (λx.(x y) λy.y))


(L/P) De cate ori se satisface scopul ?- p(X). unde:


p(a).
q(a).
q(b).
r(a).
r(b).
p(X) :- q(X), !, r(X).


Justificati.</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:adt&amp;rev=1490004966&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2017-03-20T12:16:06+03:00</dc:date>
        <title>pp:adt</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:adt&amp;rev=1490004966&amp;do=diff</link>
        <description>Abstract Datatypes

Intro

An Abstract Datatype relies on functions to describe the possible values of a type. We start with a simplistic example:


data Nat = Zero | Succ Nat


	*  the expression data Nat introduces a new type in the programming language</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:c06&amp;rev=1493024928&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2017-04-24T12:08:48+03:00</dc:date>
        <title>pp:c06</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:c06&amp;rev=1493024928&amp;do=diff</link>
        <description>Parameter passing in different programming languages

Different programming languages adopt different strategies for passing (and evaluating) parameters during function calls. Such strategies can be split into two categories:

	*  applicative
	*  normal</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:c07&amp;rev=1493025684&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2017-04-24T12:21:24+03:00</dc:date>
        <title>pp:c07</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:c07&amp;rev=1493025684&amp;do=diff</link>
        <description>Lazy Evaluation in Haskell

Introduction

Lazy evaluation means that:

	*  an expression (function application) will be evaluated only when it is needed (precisely as in the Lambda Calculus's normal evaluation)
	*  an expression is evaluated only once</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:c08&amp;rev=1523291383&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2018-04-09T19:29:43+03:00</dc:date>
        <title>pp:c08</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:c08&amp;rev=1523291383&amp;do=diff</link>
        <description>Introduction to Prolog

The basics

Consider the following code:


student(gigel).
student(ionel).
student(john).
student(mary).

male(gigel).
male(ionel).
male(john).
female(mary).

lecture(pp).
lecture(aa).

studies(gigel,aa).
studies(mary,pp).
studies(mary,aa).
studies(john,pp).

$ A_1, \ldots, A_n$$ R\subseteq A_1 \times \ldots \times A_n$$ A_i$$ R\subseteq Prim$$ Prim$$ studies=\{(gigel,aa),(mary,pp),(mary,aa), (john,pp)\}$$ R(t_1,\ldots, t_n)$$ t_i$$ student(M) \wedge male(M) \wedge studie…</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:c09&amp;rev=1494479690&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2017-05-11T08:14:50+03:00</dc:date>
        <title>pp:c09</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:c09&amp;rev=1494479690&amp;do=diff</link>
        <description>Formal syntax, Unification, Backtracking, Cut, Negation

Prolog syntax

The basic programming building block in Prolog is the clause. To define it formally, we first introduce:


&lt;var&gt; ::= alphanumeric sequence starting with capital
&lt;term&gt; ::= &lt;number&gt; | &lt;atom&gt; | &lt;var&gt; | &lt;predicate&gt;(&lt;term1&gt; ..., &lt;term_n&gt;)  

$ t =_S t'$$ (X,t)$$ X$$ t$$ t/X$$ (X,t)$$ S$$ t_1/X$$ t_2/X$$ t_1 =_S t_2$$ X$$ \displaystyle\frac{}{atom =_S atom}$$ \displaystyle\frac{S \cup \{t/X\} \text{ is consistent }}{X =_S t}$$ X=…</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:class&amp;rev=1618168558&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-04-11T22:15:58+03:00</dc:date>
        <title>pp:class</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:class&amp;rev=1618168558&amp;do=diff</link>
        <description>6. Classes in Haskell

Default Classes

Today you can use the provided .

Last time we've learned how to define our new data types in Haskell. The simpler ones were Ordering (some “constants”), Point Float Float, and Student String String [Float]</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:exam2022&amp;rev=1653647120&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2022-05-27T13:25:20+03:00</dc:date>
        <title>pp:exam2022</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:exam2022&amp;rev=1653647120&amp;do=diff</link>
        <description>Examen PP 2022

* 12 Exercitii. 8=40 (maxim)

40p - 8p - 12</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:examen2021&amp;rev=1621513768&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-05-20T15:29:28+03:00</dc:date>
        <title>pp:examen2021</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:examen2021&amp;rev=1621513768&amp;do=diff</link>
        <description>Examen PP (sesiunea 2021)

Examenul la PP se va desfasura online, si va consta intr-o proba de programare ce va contine:

	*  (L/P) o intrebare legata de Calcul Lambda sau un exercitiu de programare din Prolog
	*  (E1) un exercitiu de programare functionala scurt$ (\lambda x.(x\;x)\;(\lambda y.y\;\lambda z.z))$$ e^x$$ e^x = \displaystyle\sum_{n = 0}^\infty \frac{x^n}{n!}$</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:examen2022&amp;rev=1653561176&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2022-05-26T13:32:56+03:00</dc:date>
        <title>pp:examen2022</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:examen2022&amp;rev=1653561176&amp;do=diff</link>
        <description>Examen PP 2022

	*  Examenul la PP va consta in implementarea unor functii, in stil functional, in limbajul Haskell. 
	*  Examenul se va desfasura exclusiv fizic.
	*  Folosirea laptopului va fi obligatorie la examen.
	*  Rezolvarea va consta intr-o submisie</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:functors&amp;rev=1619009473&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-04-21T15:51:13+03:00</dc:date>
        <title>pp:functors</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:functors&amp;rev=1619009473&amp;do=diff</link>
        <description>7. Functors, Foldables

Functors are data types over which we can map a function (that is, apply a function on each element while keeping the overall structure). You've already encountered a Functor, namely haskell lists. For historical reasons, map only works on lists (</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:h01&amp;rev=1522320746&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2018-03-29T13:52:26+03:00</dc:date>
        <title>pp:h01</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:h01&amp;rev=1522320746&amp;do=diff</link>
        <description>To access the two links you must log in with your LDAP account.

 Homework Statement

 Homework Archive</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:haskell-environment&amp;rev=1550246808&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2019-02-15T18:06:48+03:00</dc:date>
        <title>pp:haskell-environment</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:haskell-environment&amp;rev=1550246808&amp;do=diff</link>
        <description>Haskell Environment

Setup

Primul pas spre a putea învăța Haskell este să avem o modalitate de a rula codul scris. Puteți descărca platforma Haskell de aici (Windows/OS X/Linux) sau puteți căuta pachetul “ghc” în repourile distribuției voastre.</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:high&amp;rev=1616307295&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-03-21T08:14:55+03:00</dc:date>
        <title>pp:high</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:high&amp;rev=1616307295&amp;do=diff</link>
        <description>Higher-order functions

In our previous examples, we have seen functions such as (+) or (*) which are passed as parameter to other functions, e.g. foldr. A function which expects another function as parameter is called a higher-order function.

One distinctive functional programming trait relies on defining and using higher-order functions. Haskell makes this programming style very natural.</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:hoogle&amp;rev=1555069782&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2019-04-12T14:49:42+03:00</dc:date>
        <title>pp:hoogle</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:hoogle&amp;rev=1555069782&amp;do=diff</link>
        <description>Hoogle

Hoogle este un motor de căutare pentru funcții, tipuri, clase etc. de Haskell. Puterea sa constă în abilitatea de a căuta funcții atât după nume cât și după tip.

Căutare după nume

Considerați că tocmai ați auzit de funcția Haskell</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:intro&amp;rev=1550161149&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2019-02-14T18:19:09+03:00</dc:date>
        <title>pp:intro</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:intro&amp;rev=1550161149&amp;do=diff</link>
        <description>Introduction to Programming Paradigms

In how many different ways can we reverse a sequence of integers?

We start the lecture by looking at three different Java programs which reverse a sequence of integers.

The Cook-book style:


public class Rev {
	public static void main (String[] args) {
		Integer[] v = new Integer[] {1,2,3,4,5,6,7,8,9};
		int i=0;
		while (i &lt; v.length/2){
			int t = v[i];
			v[i] = v[v.length-1-i];
			v[v.length-1-i] = t;
			i++;
		} 
		show(v);
	}
}

$ n/2$$ n$</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l01&amp;rev=1586261126&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2020-04-07T15:05:26+03:00</dc:date>
        <title>pp:l01</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l01&amp;rev=1586261126&amp;do=diff</link>
        <description>1. Introduction to the Haskell language

The main (and, as we shall soon see, the only!) programming instrument in Haskell is the function. In mathematics, a function is a relation between specified sets ($ f:A\rightarrow B$ ) that associates to every element of $ A$ , exactly one element of $ B$$ f(x,y) = x$</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l02&amp;rev=1615915489&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-03-16T19:24:49+03:00</dc:date>
        <title>pp:l02</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l02&amp;rev=1615915489&amp;do=diff</link>
        <description>2. Pattern matching and basic types in Haskell

2.1. Pattern matching

It is likely that in the above implementations you used head and tail, or branch definitions combined with '_' to solve the exercises. Haskell supports a more elegant means of value introspection</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l03&amp;rev=1647782004&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2022-03-20T15:13:24+03:00</dc:date>
        <title>pp:l03</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l03&amp;rev=1647782004&amp;do=diff</link>
        <description>3. Higher-order functions

Function application and composition as higher-order functions

One key idea from functional programming is that functions are first-class (or first-order) values, just like integers, strings, etc. . They can be passed as function $ \{1,2\}$$ \{2^n \mid n\in\mathbb{N}\}$</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l04&amp;rev=1679504069&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2023-03-22T18:54:29+03:00</dc:date>
        <title>pp:l04</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l04&amp;rev=1679504069&amp;do=diff</link>
        <description>4. Working with matrices and images using higher-order functions

1. Introduction

We shall represent matrices as lists of lists, i.e. values of type [ [Integer ] ]. Each element in the outer list represents a line of the matrix. 
Hence, the matrix

$  \displaystyle \left(\begin{array}{ccc} 1 &amp; 2 &amp; 3 \\ 4 &amp; 5 &amp; 6 \\ 7 &amp; 8 &amp; 9 \\ \end{array}\right)$$  \displaystyle 2 * \left(\begin{array}{ccc} 1 &amp; 2 &amp; 3 \\ 4 &amp; 5 &amp; 6 \\ 7 &amp; 8 &amp; 9 \\ \end{array}\right) = \left(\begin{array}{ccc} 2 &amp; 4 &amp; 6 \\ 8 &amp; 10…</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l04x&amp;rev=1617623499&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-04-05T14:51:39+03:00</dc:date>
        <title>pp:l04x</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l04x&amp;rev=1617623499&amp;do=diff</link>
        <description>5. Algebraic Datatypes in Haskell

There are multiple ways of defining new data types in Haskell. In this session, we will focus on Algebraic Data Types, which allow us to specify multiply constructors, with any number of arguments.

A new ADT can be defined using the keyword $ \forall i, j; i &lt; j, comparator(l_i, l_j) \neq GT$</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l04xx&amp;rev=1586261477&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2020-04-07T15:11:17+03:00</dc:date>
        <title>pp:l04xx</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l04xx&amp;rev=1586261477&amp;do=diff</link>
        <description>6. Programming with ADTs

1. A dictionary is a collection of key-value pairs, which we can represent in Haskell as a list of pairs (String,Integer) where String is the key type and Integer is the value type:


type Dict = [(String,Integer)]


Implement the function</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l05&amp;rev=1580910611&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2020-02-05T15:50:11+03:00</dc:date>
        <title>pp:l05</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l05&amp;rev=1580910611&amp;do=diff</link>
        <description>Clase de tipuri (Typeclasses)

Scopul laboratorului:

	*  introducerea conceptului de clase de tipuri
	*  introducerea conceptului de constrângeri de tip
	*  clarificarea distincției dintre “polimorfism parametric” și “polimorfism ad hoc”</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l05x&amp;rev=1586261503&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2020-04-07T15:11:43+03:00</dc:date>
        <title>pp:l05x</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l05x&amp;rev=1586261503&amp;do=diff</link>
        <description>7. Haskell type-classes

1. Enroll the type Extended shown below, in class Eq:


data Extended = Infinity | Value Integer 


2. Enroll the type Formula a in class Eq:


data Formula a = Atom a |
                 Or (Formula a) (Formula a) |
                 And (Formula a) (Formula a) |
                 Not (Formula a)</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l06&amp;rev=1580910651&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2020-02-05T15:50:51+03:00</dc:date>
        <title>pp:l06</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l06&amp;rev=1580910651&amp;do=diff</link>
        <description>Evaluare leneșă

Moduri de evaluare a unei expresii:

	*  evaluare aplicativă - argumentele funcțiilor sunt evaluate înaintea aplicării funcției asupra lor.
		*  evaluare lenesa - întârzie evaluarea parametrilor până în momentul când aceasta este folosită efectiv.$ e$$ l$$ l_n$$ abs(l_n - l_{n+1}) &lt; e$$ \displaystyle \lim_{n \rightarrow \infty} \frac{F_{n+1}}{F_n} = \varphi$$ F_n$$ \varphi$$ \varphi$$ a_{n+1} = a_n + sin(a_n)$$ a_0$$ a_{n+1} != a_n$$ \displaystyle \lim_{n \rightarrow \infty} a_n…</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l07&amp;rev=1557132068&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2019-05-06T11:41:08+03:00</dc:date>
        <title>pp:l07</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l07&amp;rev=1557132068&amp;do=diff</link>
        <description>Prolog: Introducere

Scopul laboratorului:

	*  Familiarizarea studenților cu limbajul Prolog

Despre Prolog

Prolog este un limbaj de programare logică, bazat pe un set mic de mecanisme de baza (e.g. pattern-matching, backtracking). Deși setul de mecanisme de baza este limitat, Prolog este un limbaj foarte puternic și flexibil.</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l08&amp;rev=1586720055&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2020-04-12T22:34:15+03:00</dc:date>
        <title>pp:l08</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l08&amp;rev=1586720055&amp;do=diff</link>
        <description>8. The Lambda Calculus

1. Consider the following datatype which encodes λ-expressions:


data LExpr = Var Char | Lambda Char LExpr | App LExpr LExpr 


Enroll LExpr in class Show.

2. Write a function vars which returns a list of variables used in a λ-expression:</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l09&amp;rev=1587832308&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2020-04-25T19:31:48+03:00</dc:date>
        <title>pp:l09</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l09&amp;rev=1587832308&amp;do=diff</link>
        <description>Lazy evaluation

1. Consider the following recurrence scheme described informally below. Use it to build the sequence $ 1, 2, \ldots, n!, \ldots$


     4  4*5   4*5*6  ...
  3  3  3     3
  ----------------------
  3 3*4 3*4*5 3*4*5*6 ...    


2. Define the sequence $ 1, \frac{1}{2}, \ldots, \frac{1}{k!}, \ldots $

3. Write a function which takes a sequence $ (a_n)_{n\geq 0}$$ (s_n)_{n\geq 0}$$ s_k = \sum_{k\geq 0} a_k$$ e$$ d$$ (a_n)_{n\geq 0}$$ a_k$$ \mid a_k - a_{k+1}\mid \leq d$$ f$$ a_0$$…</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l10&amp;rev=1621946682&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-05-25T15:44:42+03:00</dc:date>
        <title>pp:l10</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l10&amp;rev=1621946682&amp;do=diff</link>
        <description>Introduction to Prolog programming

1. Write a query which returns all student names (first and last name), which were born in 1990.

(hint: use _ in place of those variables which are not to be shown).

2. Write a query which returns all student names which were born before 1990.</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l11&amp;rev=1589888571&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2020-05-19T14:42:51+03:00</dc:date>
        <title>pp:l11</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l11&amp;rev=1589888571&amp;do=diff</link>
        <description>Generative predicates

1. Write the predicate sublist/2 which constructs each sublist of a given list. Hint: use append.


?- sublist([7,2,9],R).
% R will subsequently be bound to [], [7], [2], [9], [7,2], [2,9], [7,2,9] 


2. Rewrite the predicate such that the empty list is reported only once.</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l12&amp;rev=1589482560&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2020-05-14T21:56:00+03:00</dc:date>
        <title>pp:l12</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l12&amp;rev=1589482560&amp;do=diff</link>
        <description>Lab 12: Programming with cut and not

A tic-tac-toe table is encoded as a list [ [X1,Y1,Z1], [X2,Y2,Z2], [X3,Y3,Z3] ] where a variable is bound to atom x or z (zero) if the position has been played or it is uninstantiated otherwise.

1. Write the predicate $ X_1, X_2, \ldots, X_n$$ X_1, X_2, \ldots, X_n$$ D_1, D_2, \ldots, D_n$$ v_1, v_2, \ldots, v_n$$ v_i \in D_i$$ v_1, v_2, \ldots, v_n$</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l112021&amp;rev=1622368665&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-05-30T12:57:45+03:00</dc:date>
        <title>pp:l112021</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:l112021&amp;rev=1622368665&amp;do=diff</link>
        <description>Prolog Programming

1. Lists

1.1. Write a predicate endsWith(X,L), which checks if the list L ends with element X.

1.2. Write a predicate sameFirstLast(L) which checks if the list L begins and ends with the same element.

1.3. Write a predicate inner(L1,L2)$ P$$ x_1, \ldots, x_n$$ \sum_{x_i\in P}x_i = \sum_{x_i \not\in P}x_i$</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lab_solutions&amp;rev=1551982201&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2019-03-07T20:10:01+03:00</dc:date>
        <title>pp:lab_solutions</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lab_solutions&amp;rev=1551982201&amp;do=diff</link>
        <description>Rezolvări laboratoare

Puteți descărca rezolvările laboratoarelor de la această adresă</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lambda&amp;rev=1554748417&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2019-04-08T21:33:37+03:00</dc:date>
        <title>pp:lambda</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lambda&amp;rev=1554748417&amp;do=diff</link>
        <description>The Lambda Calculus

A brief history

The Lambda Calculus was created in 1928 by Alonzo Church. (To be expanded).

Intuition

At first glance, the Lambda Calculus formalises the fundamental concept of function application from mathematics. Consider the function $ f(x) = x + 1$$ f(2)$$ f$$ 2$$ 2$$ 2+1$$ x, y, \ldots$$ V$$ e$$ e ::= x \in V \mid \lambda x.e \mid (e_1\;e_2)$$ \lambda$$ x$$ \lambda x.x$$ (\lambda x.\lambda y.x\;z)$$ V$$ \lambda x\lambda y.body$$ \lambda x.x$$ \lambda x.y$$ y$$ \lamb…</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lazylab&amp;rev=1619360442&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-04-25T17:20:42+03:00</dc:date>
        <title>pp:lazylab</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lazylab&amp;rev=1619360442&amp;do=diff</link>
        <description>8. Lazy evaluation

When passing parameters to a function, programming language design offers two options which are not mutually exclusive (both strategies can be implemented in the language):

	*  applicative (also called strict) evaluation strategy:$ e$$ l$$ l_n$$ abs(l_n - l_{n+1}) &lt; e$$ \displaystyle \lim_{n \rightarrow \infty} \frac{F_{n+1}}{F_n} = \varphi$$ F_n$$ \varphi$$ \varphi$$ a_{n+1} = a_n + sin(a_n)$$ a_0$$ a_{n+1} != a_n$$ \displaystyle \lim_{n \rightarrow \infty} a_n = \pi$$ \pi$…</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lecture01&amp;rev=1646302352&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2022-03-03T12:12:32+03:00</dc:date>
        <title>pp:lecture01</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lecture01&amp;rev=1646302352&amp;do=diff</link>
        <description>Introduction to Haskell

Different ways of defining the sum function in Haskell:


sum1 :: [Int] -&gt; Int -&gt; Int -&gt; Int 
sum1 v crt_sum crt_index = if crt_index == (length v)
                           then crt_sum
                           else sum1 v (crt_sum + (v !! crt_index)) (crt_index + 1)

sum2 v crt_sum crt_index 
    | crt_index == (length v) = crt_sum
    | otherwise = sum2 v (crt_sum + (v !! crt_index)) (crt_index + 1)
    
sum3 v crt_sum 
    | v == [] = crt_sum
    | otherwise = sum…</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lecture03&amp;rev=1647360263&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2022-03-15T18:04:23+03:00</dc:date>
        <title>pp:lecture03</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lecture03&amp;rev=1647360263&amp;do=diff</link>
        <description>Higher order functions and functional closures

Using: higher-order functions, infix/prefix notation, anonymous functions (lambdas) and functional closures to write better code:


import Data.Char

-- map examples
addOne :: [Integer] -&gt; [Integer]
addOne = map (+1)

remHead = map tail 

toString = map (:[])

fold op acc [] = acc
fold op acc (x:xs) = x 0111p0032(fold op acc xs)

sum = foldr (+) 0 

-- operatia de adunare, prefixata, este (+)

makeLower = foldr ((:).toLower) []

reverse :: [a] …</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lecture05&amp;rev=1647512584&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2022-03-17T12:23:04+03:00</dc:date>
        <title>pp:lecture05</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lecture05&amp;rev=1647512584&amp;do=diff</link>
        <description>Aplicatii (higher-order functions)

Separarea unui sir dupa un caracter, folosind foldr:


spaceSep :: String -&gt; [String]
spaceSep = foldr op []
               where op :: Char -&gt; [String] -&gt; [String]
                     op ' ' acc = []:acc
                     op x [] = [[x]]  -- atentie!
                     op x (y:ys) = (x:y):ys 
                     
charSep :: Char -&gt; String -&gt; [String]
charSep c = foldr op []
               where op x []
                       | x == c = []
             …</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lecture07&amp;rev=1648453442&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2022-03-28T10:44:02+03:00</dc:date>
        <title>pp:lecture07</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lecture07&amp;rev=1648453442&amp;do=diff</link>
        <description>Algebraic datatypes



data TList = Void | Cons Integer TList

tlength :: TList -&gt; Integer
tlength Void = 0
tlength (Cons i l) = 1 + tlength l


data PList a = PVoid | PCons a (PList a)

plength :: PList a -&gt; Integer
plength PVoid = 0
plength (PCons i l) = 1 + plength l

toHaskell :: PList a -&gt; [a]
toHaskell PVoid = []
toHaskell (PCons i l) = i:(toHaskell l)

fromHaskell :: [a] -&gt; PList a
fromHaskell [] = PVoid
fromHaskell (x:xs) = PCons x (fromHaskell xs)


fromm :: [a] -&gt; PList a
fromm = foldr…</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lecture08&amp;rev=1648569543&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2022-03-29T18:59:03+03:00</dc:date>
        <title>pp:lecture08</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lecture08&amp;rev=1648569543&amp;do=diff</link>
        <description>L08. Typeclasses


{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses #-}

{-
(A) Ad-hoc polymorphism:
   &quot;Ad-hoc polymorphism is obtained when a function works, or appears to work,
   on several different types (which may not exhibit a common structure)
   and may behave in unrelated ways for each type.&quot; – Strachey 1967

(B) Subtype polymorphism:
  A type S (subtype) is related to another type T (supertype) by some
  notion of substitutability, meaning that functions written to operate on
  …</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lecture09&amp;rev=1648746745&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2022-03-31T20:12:25+03:00</dc:date>
        <title>pp:lecture09</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lecture09&amp;rev=1648746745&amp;do=diff</link>
        <description>L09. Type constructors


{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses #-}


data Tree a = TVoid | Node (Tree a) a (Tree a)

data List a = LVoid | Cons a (List a)

-- member :: Container of a's -&gt; a -&gt; Bool
-- attempt1:

class Contains a b where
	member :: a -&gt; b -&gt; Bool

instance Contains Char (List Char) where
	member _ _ = False -- stub implementation
{-This implementation is very particular.-}


instance Eq a =&gt; Contains a (List a) where
	member _ LVoid = False
	member y (Cons x xs) …</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lecture12&amp;rev=1650361818&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2022-04-19T12:50:18+03:00</dc:date>
        <title>pp:lecture12</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lecture12&amp;rev=1650361818&amp;do=diff</link>
        <description>L12. Lazy evaluation


{-

Lazy evaluation strategy:
  - evaluate function first (not parameter first)
  - evaluate each expression AT MOST ONCE!


Applications:
-}


ones = 1:ones

-- evaluating ones loops.

get 0 (x:xs) = []
get k (x:xs) = x : get (k-1) xs

{-

get 2 ones
get 2 (1:ones)
1:(get 1 ones)
1:(get 1 (1:ones))
1:(1:(get 0 ones))
1:(1:[])

[1,1]
-}

member :: Eq a =&gt; a -&gt; [a] -&gt; Bool

member x = foldr ((||).(==x)) False

or False x = x
or True _ = True

{-
member 1 [2,1,3,4,5,6,7]
fol…</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lecture13&amp;rev=1650361886&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2022-04-19T12:51:26+03:00</dc:date>
        <title>pp:lecture13</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lecture13&amp;rev=1650361886&amp;do=diff</link>
        <description>L13. Lazy dynamic programming


import Data.Array

t0 = [2,3,5,1,4]
t1 = [2,3,5,1,4,6,7,1,2,3,5,3,4,7,1,2,3,4,5,6,7,5,3,4,5,6,7,6,3,2]
t2 = [2,3,5,1,4,6,7,1,2,3,5,3,4,7,1,2,3,4,5,6]

-- recursive solution:
sol0 :: [Integer] -&gt; Integer
sol0 prices = max_profit 0 ((length prices) - 1) 1
                where max_profit left right year
                            | left &gt; right = 0
                            | otherwise = maximum [year*(prices !! left) + (max_profit (left+1) right (year+1)),
     …</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lecture15&amp;rev=1651763056&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2022-05-05T18:04:16+03:00</dc:date>
        <title>pp:lecture15</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lecture15&amp;rev=1651763056&amp;do=diff</link>
        <description>L15. Introduction to Scala


/*
Sintaxa basic:
 */

val s = &quot;Hello World&quot;

def fibo(n: Int): Int =
  if (n == 0) 0
  else if (n == 1) 1
  else fibo(n-1) + fibo(n-2)

// varianta tail-recursiva
// cum putem defini functii auxiliare (where)
def fibo1(n: Int): Int = {

  def fib_aux(n: Int,
              last: Int,
              before_last: Int): Int =
    if (n == 0) last
    else fib_aux(n-1,before_last+last,last)

  fib_aux(n,1,0)
}

fibo(3)

/* Functii de ordin superior */

def sumOf(start: In…</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lecture16&amp;rev=1652195122&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2022-05-10T18:05:22+03:00</dc:date>
        <title>pp:lecture16</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lecture16&amp;rev=1652195122&amp;do=diff</link>
        <description>L16. Case classes


/*
Clase in Scala
 */
class Point(a: Int, b: Int)  {
  def getA: Int = a
  def getB: Int = b

  def higher(p: Point): Boolean =
    a &gt;= p.getA

  //string interpolation
  override def toString = s&quot;(${a},${b})&quot;
}

new Point(1,2)
new Point(2,1) == new Point(2,1)

trait TwoDimensionalObject{
  def distanceFromOrigin: Int
}

trait FTree

case class FNode (key: Int,
                  left: FTree,
                  right: FTree)
  extends FTree
  // o singura instanta a FEmpty
  /…</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lecture18&amp;rev=1653561427&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2022-05-26T13:37:07+03:00</dc:date>
        <title>pp:lecture18</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lecture18&amp;rev=1653561427&amp;do=diff</link>
        <description>C18. Scala Hacks


// for expressions
List(1,2,3).filter(_&gt;2).map(_+1)

for (x &lt;- List(1,2,3) if x &gt; 2) yield x + 1

for (x &lt;- List(1,2,3);
     y &lt;- List(4,5,6))
      yield (x,y)

// List[List[(Int,Int)]]
for (x &lt;- List(1,2,3))
  yield
    for (y &lt;- List(4,5,6))
      yield (x,y)

// Cateva lucruri despre colectii
// Despre Vector

val letters = Vector(&quot;v&quot;, &quot;m&quot;, &quot;n&quot;, &quot;i&quot;, &quot;b&quot;, &quot;s&quot;)

// reprezentati ca arbori, cu branching foarte mare
// si adancime foarte mica

//
//  &lt;colectie&gt; :&lt;op&gt; &lt;valoare…</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lheap&amp;rev=1555586628&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2019-04-18T14:23:48+03:00</dc:date>
        <title>pp:lheap</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lheap&amp;rev=1555586628&amp;do=diff</link>
        <description>Structuri funcționale de date

Scopul laboratorului:

	*  recapitularea conceptelor învățate
	*  programarea cu o structură de date funcțională
	*  înțelegerea conceptului de “leftist heap”

Priority Queue

O coadă de priorități (&quot;priority queue&quot;) este o structură de date în care putem stoca elemente și din care îl putem scoate pe cel cu prioritatea cea mai mare. Spre deosebire de o coadă normală, care respectă principiul First In, First Out, elementele unei cozi de priorități sunt scoase în ord…</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:llambdacalc&amp;rev=1580910633&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2020-02-05T15:50:33+03:00</dc:date>
        <title>pp:llambdacalc</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:llambdacalc&amp;rev=1580910633&amp;do=diff</link>
        <description>Evaluare expresii lambda

Scopul laboratorului:

	*  obișnuirea studenților cu calculul lambda:
		*  ce e o expresie
		*  ce sunt variabilele libere/legate
		*  cum se evaluează o expresie

	*  implementarea unei aplicații practice de evaluare a expresiilor lambda (în Haskell)$ x$$ x$$\lambda x . E$$ x$$ E$$(E_1\ E_2)$$ E_1$$ E_2$$\lambda x.E$$ x$$ E$$(E_1\ E_2)$$ E_1$$ E_2$$ y$$\lambda x.x$$(\lambda x.x\ y)$$((\lambda x.\lambda y.x\ z)\ \lambda x.x)$$ x$$ E_1$$ E_2$</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lplcut&amp;rev=1557142249&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2019-05-06T14:30:49+03:00</dc:date>
        <title>pp:lplcut</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lplcut&amp;rev=1557142249&amp;do=diff</link>
        <description>Cuts

Scopul laboratorului:

	*  aprofundarea mecanismului de căutare din prolog
	*  înțelegerea cut-urilor ca mecanism de control al căutării
	*  distincția între “green cuts” și “red cuts”
	*  metode de colectare a rezultatelor

Cut</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lplprobs&amp;rev=1580910726&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2020-02-05T15:52:06+03:00</dc:date>
        <title>pp:lplprobs</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:lplprobs&amp;rev=1580910726&amp;do=diff</link>
        <description>Căutare în spațiul stărilor

Scopul laboratorului:

	*  aprofundarea mecanismului de căutare din prolog
	*  metode de colectare a rezultatelor

Avantaje prolog

Problemele de logică pot fi reprezentate, cât și rezolvate cu mare ușurință în Prolog.
Să luăm un exemplu de problemă de logică -</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:main&amp;rev=1488115002&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2017-02-26T15:16:42+03:00</dc:date>
        <title>pp:main</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:main&amp;rev=1488115002&amp;do=diff</link>
        <description>Programming Paradigms

Contents

	*  Introduction
	*  Tail-end Recursion
	*  Team</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:other-exercises&amp;rev=1616307273&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-03-21T08:14:33+03:00</dc:date>
        <title>pp:other-exercises</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:other-exercises&amp;rev=1616307273&amp;do=diff</link>
        <description>Matrices

Haskell implementation of foldl

In Haskell, foldl is implemented as follows:


foldl op acc []     = acc                  
foldl op acc (h:t) = foldl op (op acc h) t


Note the call of the op function.

An exercise in modular programming with higher-order functions</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:plagiarism&amp;rev=1614927331&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-03-05T08:55:31+03:00</dc:date>
        <title>pp:plagiarism</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:plagiarism&amp;rev=1614927331&amp;do=diff</link>
        <description>Reguli de integritate academica

Conform regulamentului de desfasurare a studiilor de licenta (articolul 51. punctele d. si i.), studentul are obligatia de a respecta regulile de etica universitara si deontologie academica, specificate in Carta UPB. In cadrul acesteia din urma (articolul 45. punctul 13) a., plagiatul constituie o abatere grava</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:polymorphism&amp;rev=1523970365&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2018-04-17T16:06:05+03:00</dc:date>
        <title>pp:polymorphism</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:polymorphism&amp;rev=1523970365&amp;do=diff</link>
        <description>Polymorphism in functional languages

Polymorphism in Object-Oriented languages

Translated literally, the term polymorphism means multiple shapes. Polymorphism in programming languages is a powerful modularisation tool, which allows programmers to:</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:project2021&amp;rev=1652283921&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2022-05-11T18:45:21+03:00</dc:date>
        <title>pp:project2021</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:project2021&amp;rev=1652283921&amp;do=diff</link>
        <description>Project PP 2022

General info

Project team

	*  Mihai-Valentin DUMITRU
	*  Vlad-Andrei BĂDOIU
	*  Teodora-Andreea ION
	*  Mihai UDUBAȘA
	*  Matei POPOVICI

	*  Your Teaching Assistant
		*  You are highly encouraged to talk with your TA about the project and to ask questions during lab. You may also have sessions outside lab hours to check your code with them (either requested by you or by them).$(10+11+12+13+14+15+16+17)/8$$[0-50)$$[50-100)$$[100,500)$</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:reading&amp;rev=1580910209&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2020-02-05T15:43:29+03:00</dc:date>
        <title>pp:reading</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:reading&amp;rev=1580910209&amp;do=diff</link>
        <description>Resurse Utile

Programare funcțională și Haskell

	*  Why Functional Programming Matters
		*  un articol important despre avantajele programării funcționale

	*  Why Haskell Matters
		*  articol despre avantajele limbajului Haskell, în particular


	*  Haskell in industry
		*  listă de companii care folosesc Haskell intern sau în producție</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:rec&amp;rev=1550439736&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2019-02-17T23:42:16+03:00</dc:date>
        <title>pp:rec</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:rec&amp;rev=1550439736&amp;do=diff</link>
        <description>Side-effects

Programming with side-effects is one defining feature of imperative programming. A procedure produces a side-effect if its call produces a change in the state of a running program (the memory), apart from the returned value.

We (re-)consider the following code discussed in the previous lecture:</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:rules&amp;rev=1646029928&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2022-02-28T08:32:08+03:00</dc:date>
        <title>pp:rules</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:rules&amp;rev=1646029928&amp;do=diff</link>
        <description>Regulament

Punctajul este organizat astfel:

	*  Parcurs: 7p
	*  Examen: 4p 
	*  pentru intrarea în examen sunt necesare:
			*  minim 3p din punctajul de parcurs
			*  minim 2.5p din punctajul pe proiect

	*  pentru promovarea examenului sunt necesare</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:scala-environment&amp;rev=1772094973&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2026-02-26T10:36:13+03:00</dc:date>
        <title>pp:scala-environment</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:scala-environment&amp;rev=1772094973&amp;do=diff</link>
        <description>Scala setup

Installation

Scala can be downloaded and installed on either a Windows or NIX platform (e.g. Linux, OS-X) here. For this lecture you must install Scala 3, and we recommend installing it using Coursier (see the previous link)

IDE

One of the most widely used IDE (Integrated Development Environment) for Scala is:</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:scala-project&amp;rev=1641981501&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2022-01-12T11:58:21+03:00</dc:date>
        <title>pp:scala-project</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:scala-project&amp;rev=1641981501&amp;do=diff</link>
        <description>Scala @ PP

&quot;Meta ideas&quot;

Test-driven development

1. Installation

2. Syntax

2.1. Writing functions
2.2. Function evaluation (order of parameters in function call matters !)

	*  using the =&gt; to delay evaluation

2.3. Conditionals

	*   def f(x : Int) = if (x &gt;= 0) x else -x</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:scalalab1&amp;rev=1651933589&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2022-05-07T17:26:29+03:00</dc:date>
        <title>pp:scalalab1</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:scalalab1&amp;rev=1651933589&amp;do=diff</link>
        <description>1. Scala syntax, function definition and higher-order functions

 Objectives: 

	*  get yourself familiar with Scala syntax basics
	*  practice writing tail-recursive functions as an alternative to imperative loops 
	*  keep your code clean and well-structured.$ n$$ 1 + 2^2 + 3^2 + \ldots + (n-1)^2 + n^2$$ \sqrt{a}$$ x_0 = 1$$ x_{n+1} = \displaystyle\frac{1}{2}(x_n+\frac{a}{x_n})$$ x_n$$ \sqrt{a}$$ x_{n+1}$$ x_0 = 1$$ x_n$$ \sqrt{a}$$ a$$ n$$ (x_n)_n$$ \sqrt{a}$$ \mid x_n^2 - a \mid \leq 0.001$$…</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:scalalab2&amp;rev=1652908605&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2022-05-19T00:16:45+03:00</dc:date>
        <title>pp:scalalab2</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:scalalab2&amp;rev=1652908605&amp;do=diff</link>
        <description>L10. List and Datatypes and Functional data representation

Objectives:

	*  get familiar with pattern matching lists, as well as common list operations from Scala and how they work
	*  get familiar with common higher-order functions over lists (partition, map, foldRight, foldLeft, filter)</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:scalalab3&amp;rev=1653430554&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2022-05-25T01:15:54+03:00</dc:date>
        <title>pp:scalalab3</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:scalalab3&amp;rev=1653430554&amp;do=diff</link>
        <description>Lab 11. Polymorphism and For expressions in Scala

I. Polymorphism

This lab will start with the implementations discussed during lecture. Please find the polymorphic trait FList[A] below:


trait FList[A]{ // list with elements of type A
  def length: Int
  def head: A
  def tail: FList[A]
  def map[B](f: A =&gt; B): FList[B]
  // a op (b op (c op acc))
  def foldRight[B](acc: B)(op: (A,B) =&gt; B): B
  // ((acc op a) op b) op c
  def foldLeft[B](acc: B)(op: (B,A) =&gt; B): B
  
  def contains(e: A):Boo…</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:syntax&amp;rev=1584047882&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2020-03-12T23:18:02+03:00</dc:date>
        <title>pp:syntax</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:syntax&amp;rev=1584047882&amp;do=diff</link>
        <description>Crash course into Haskell's syntax

Haskell in the Programming Paradigms lecture

We use Haskell at PP in order to illustrate some functional programming concepts (or functional programming design patterns) which can be used in any functional or multi-paradigm lecture. These are:</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:tailend&amp;rev=1462463205&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2016-05-05T18:46:45+03:00</dc:date>
        <title>pp:tailend</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:tailend&amp;rev=1462463205&amp;do=diff</link>
        <description>Tail-end Recursion

Tail-end Recursion is an efficient way of writing recursive functions so that they use less memory on the stack and sometimes improve the complexity by recurring fewer times. However, in order to use the advantages of tail-end recursion compilers have to be optimized specifically to identify situations where the stack could be used more efficiently. The utility of Tail-end Recursion will be highlighted using a practical example involving a recursive procedure that computes th…</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:team&amp;rev=1615292461&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2021-03-09T14:21:01+03:00</dc:date>
        <title>pp:team</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:team&amp;rev=1615292461&amp;do=diff</link>
        <description>Paradigme de Programare 2020-2021

Echipa

	*  Matei Popovici
	*  Bogdan-Alexandru ANDREI
	*  Mihai-Valentin DUMITRU
	*  Alexandru POBORANU
	*  Alexandru RAIT
	*  Alexandru GHICULESCU
	*  Andreea DUTULESCU
	*  Calin BUCUR
	*  Roxana STIUCA
	*  Sergiu TOADER

Curs
 Frecvență  Zi  Interval orar  Sală  Profesor  săptămânal  Vineri  12:00-14:00   MS Teams  Matei POPOVICI  săptămâni impare  Marți  16:00-18:00   MS Teams  Matei POPOVICI</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:test1_page&amp;rev=1491334526&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2017-04-04T22:35:26+03:00</dc:date>
        <title>pp:test1_page</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:test1_page&amp;rev=1491334526&amp;do=diff</link>
        <description>Test</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:test_lab2&amp;rev=1520172130&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2018-03-04T16:02:10+03:00</dc:date>
        <title>pp:test_lab2</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:test_lab2&amp;rev=1520172130&amp;do=diff</link>
        <description>Exerciții updated

1. Scrieți o funcție ce primește un număr si o listă de numere de forma [a1, a2, ... an] ca parametrii și calculează X - a1 - a2 - ... - an.

2. Inversați o listă folosind foldl.

3. Scrieți o închidere funcțională care elimină caracterul 'a' dintr-un string primit ca parametru. Scrieți o implementare ce utilizează o funcție de tip fold și alta care se folosește funcția filter.</description>
    </item>
    <item rdf:about="https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:types&amp;rev=1489399460&amp;do=diff">
        <dc:format>text/html</dc:format>
        <dc:date>2017-03-13T12:04:20+03:00</dc:date>
        <title>pp:types</title>
        <link>https://ocw.cs.pub.ro/ppcarte/doku.php?id=pp:types&amp;rev=1489399460&amp;do=diff</link>
        <description>Types in functional programming

Typing in programming languages

Strong vs weak typing

Consider the following example from Javascript, where the operator + is applied on arguments of different types. The result is given below:


[] + []  =  &quot;&quot;  
[] + {}  = &quot;[object]&quot;
{} + []  = 0
{} + {}  = null</description>
    </item>
</rdf:RDF>
