title: CS450 layout: true author: Tiago Cogumbreiro lecture: 1 abstract: Course info, arithmetic in Racket, evaluation sep: ☽ section: 2 semester: f26 <img id="logo" src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyBpZD0iYSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMTI0LjggNTkuNiI+PGRlZnM+PHN0eWxlPi5ie2ZpbGw6IzAwNWE4Yjt9PC9zdHlsZT48L2RlZnM+PHBhdGggY2xhc3M9ImIiIGQ9Ik02LjQ1LDQzLjkxYzEuMzgsMCwyLjUyLS4zMiwzLjQtLjk3LC44OC0uNjUsMS4zMi0xLjUyLDEuMzItMi42MSwwLS43OC0uMjctMS40Ny0uODEtMi4wNS0uNTQtLjU4LTEuMjUtLjk1LTIuMTUtMS4wOSwxLjY5LS41MSwyLjUzLTEuNTIsMi41My0zLjAzLDAtLjk1LS4zNy0xLjcxLTEuMTItMi4yNy0uNzUtLjU2LTEuODEtLjg0LTMuMTktLjg0SC4yOHYxMi44NUg2LjQ1Wm0tMy4zOC0xMC41NGgyLjk0Yy42NSwwLDEuMTQsLjExLDEuNDYsLjMyLC4zMiwuMjEsLjQ5LC41NywuNDksMS4wNiwwLC45My0uNjUsMS40LTEuOTUsMS40SDMuMDd2LTIuNzdoMFptMCw1LjAxaDIuOTdjMS40OSwwLDIuMjQsLjU0LDIuMjQsMS42MnMtLjc1LDEuNi0yLjI0LDEuNkgzLjA3di0zLjIxaDBabTEwLjcsNC40M2MuOTIsLjkyLDIuMDcsMS4zOSwzLjQ1LDEuMzlzMi41OS0uNDUsMy40OS0xLjM0Yy44OS0uODksMS4zNC0yLjA3LDEuMzQtMy41NHMtLjQ1LTIuNjItMS4zNS0zLjUyYy0uOS0uOS0yLjA2LTEuMzUtMy40OC0xLjM1cy0yLjU2LC40NS0zLjQ3LDEuMzVjLS45MSwuOS0xLjM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ract}} {{sep}} Lecture {{lecture}} {{sep}} {{author}} ] --- class: middle # {{title}} ## Structure of Higher Level Languages ### Lecture {{lecture}}: {{abstract}} ### {{author}} --- # About the course * **Instructor:** Tiago (蒂亚戈) Cogumbreiro .alt[(he/him)] ## How to reach me * **Office hours** in person (have priority), or remotely via Zoom * **Announcements** in `#cs450-news-{{section}}` (Discord) * **Q&A** in `#cs450-{{section}}` (Discord) --- # How we are doing remote teaching * **Open door policy, via Discord.** * Message me at any time, any day with your questions. * Channel questions answered first, direct-messages answered second. * I reply as soon as possible, during office hours in the latest. * **Homework assignments** we use a grading server (Gradescope) ## Course webpage .center[ [`cogumbreiro.github.io/teaching/cs450/{{semester}}-{{section}}/`](https://cogumbreiro.github.io/teaching/cs450/{{semester}}-{{section}}/) ] --- # Syllabus .center[ [`cogumbreiro.github.io/teaching/cs450/{{semester}}-{{section}}/syllabus.pdf`](https://cogumbreiro.github.io/teaching/cs450/{{semester}}-{{section}}/syllabus.pdf) ] .space-top.small[ | A | A-| B+ | B | B- | C+ | C | C-| D+ | D | D- | F | |--------:|---|-|-|-|-|-|-|-|-|-| | .small[100..95] | .small[94..90] | .small[89..85] | .small[84..80] | .small[79..75] | .small[74..70] | .small[69..65] | .small[59..55] | .small[54..50] | .small[49..45] | .small[44..40] | .small[39..0] | ] .space-top[] .row[] .col-6[ * Course divided into 9 modules * 1 homework assignment per module * Final grade: 95% homework + 5% participation ] .col-6[ * *Homework grade:* average of **9 assignments** (possibly weighted) * **You must pass 7** out of 9 assignments. If you fail 3 or more assignments (<40 points), then you fail the course. ] --- class: impact # Course requirements --- # Course requirements ### Checklist * Install Racket >=8.2: [`racket-lang.org`](https://racket-lang.org/) * Sign in on GitLab (invitation by email) * Sign in on Discord, say "Hi" in `#cs450-lounge-{{section}}` (invitation link in the GitLab page) * Sign in on Gradescope, upload the template `hw1.rkt` (invitation by email) ## Heads up * Please, .alt[**register using your UMB email address**], otherwise you won't be able to submit your first homework. * The deadline of homework assignment `n` is last class of module `n` plus 1 week --- class: impact # Why learn # the Structure of # Higher Level Languages? --- # Structure of Higher Level Languages > I postponed this discussion, because I felt that you are now better suited to understand and relate to the points being made. * Why learn the fundamental concepts in all programming languages? * Why learn different languages? * Why focus on functional programming? * Why use Racket? ### Disclaimer * Most of these claims are opinions * These will be mostly informal claims * We are **not** trying to find the best language (or programming model) --- # Overview * Languages are just tools, learn which language is amenable to what context * The best programming language does not exist (theoretically most languages are equivalent) * Different languages have different characteristics that favor different domains: for instance, functional languages being used in Programming Language research, C/Fortran in scientific/high-performance computing * A programming language is a computing interface: it is crucial to understand its meaning * The importance of first-class functions and avoiding mutation --- # Semantics and idioms ### Why should we care about language semantics? * **A language is a *computing user interface*.**<br/> We are learning reusable, cross-cutting patterns. * **The semantics must be *unambiguous* and *precise*.**<br/> It is not a matter of personal opinion how a conditional expression works. Language features must be described unambiguously to users. * **The semantics defines a software contract.**<br/> Is the bug in the client's bug, or is it in our code? * **Language idioms (patterns) are transferrable knowledge.**<br/> Understanding idioms (patterns) teaches you something that can be applied across languages and technologies. --- class: impact # How are all languages similar? --- # How are all languages the same? * **Theoretical:** Any input-output behavior implementable in language X is implementable in language Y ([Church-Turing thesis](https://en.wikipedia.org/wiki/Church%E2%80%93Turing_thesis)), and *equivalent to the $`\lambda`$-calculus without numbers* * **Practical:** Reoccurring fundamentals: variables, abstraction, recursive definitions --- class: impact # How are languages different? --- # Disclaimer ## Languages are not slow/fast * A language **implementation** is fast/slow, not the language itself * Certain languages computational models are more amenable to implement efficiently * Languages are user interfaces of computational models .center[ ## How different languages behave in different contexts? ] --- # Why is C faster than all other languages? > Is it because C is "close to the metal?" That is, is C fast because its semantics matches the processor's semantics? -- **No!** * Which processor? How could it match the semantics of all processors? * Which compiler? The key of C's success lays in having good compilers. * C compilers are fast because C is **old and its interface remains stable**! * Popular C compilers are **really** good at optimizing the target language. * There is a set of good practices to write optimizer-ready C code ### Take away > The facts above make C quite successful in High Performance Computing (large scale scientific > codes). .small[ Source: [*C Is Not a Low-level Language: Your computer is not a fast PDP-11*. David Chisnall. ACM Queue vol. 16, no. 2. 2018](https://queue.acm.org/detail.cfm?id=3212479) ] --- # Why is Python slow multithreading? - CPython (the main implementation of Python) is conditioned by the GIL (the Global Interpreter Lock) which effectively serializes parallel execution - To parallelize code we must run multiple processes, where shared memory is especially slow, which, in turn, slows down compute-bound programs ### Take away > Avoid running compute-bound parallel codes in Python. Maybe choose C? .small[ Source: [Global Interpreter Lock. Python Wiki. Last edit in 2017, accessed in 2019.](https://wiki.python.org/moin/GlobalInterpreterLock) ] --- # Constraint language programming > We solve the equation `SEND+MORE=MONEY` where each letter represents a digit in Prolog using a constraint language programming module: ```prolog sendmore(Digits) :- % Source: https://en.wikipedia.org/wiki/Constraint_programming Digits = [S,E,N,D,M,O,R,E], % Create variables Digits ins 0..9, % Associate domains to variables S #\= 0, % Constraint: S must be different from 0 M #\= 0, all_different(Digits), % all the elements must take different values 1000*S + 100*E + 10*N + D % Other constraints + 1000*M + 100*O + 10*R + E #= 10000*M + 1000*O + 100*N + 10*E + Y, label(Digits). % Start the search ``` ### Take away > Some problems are more amenable to certain programming languages. --- # How are languages different? 1. **The implementation matters:** A language implementation may be conditioned (faster/slower) in certain contexts 2. **The model matters:** Certain problems are simpler/more efficient to write in specific languages 3. **The domain matters:** A technology your business needs may only be available in some language (say TensorFlow in Python) --- # Why learn different languages? > Learn at least one new language every year. Source: [*The Pragmatic Programmer.* Andrew Hunt and David Thomas. 1999. ](https://pragprog.com/book/tpp/the-pragmatic-programmer) .space-above[ ### Why should you care * Deeper understanding of the differences and the similarities between languages * Learn different approaches to the same problems * More job opportunities * Better technology choices (some technologies are only available in specific languages) ] --- class: impact # Why functional programming? --- # What is functional programming? * Mutation is discouraged * Higher-order functions serve as a generalization device ## Why should we care? * These features help designing correct, elegant, and efficient software * Functional programming languages are heavily favored by PL researchers, which means they serve as **a test bed for PL design**. Functional programming is close(r) to math formalism, thus implementation is usually simpler in functional programming languages. * **Functional programming is trendy!** C++/Java/C#/Python/JavaScript are all incorporating functional programming idioms. --- # Why should we discourage mutation? * Simpler to reason about: no surprises passing a data-structure to functions/objects * Concurrency-ready: read-only means no race conditions (and no locks), which leads to simpler, faster code ## Who is using it? * `immutable.js` for JavaScript by Facebook * `vavr`, `PCollections`, the Scala runtime, and the Closure runtime for Java * `immer` for C++ * immutable collections for .NET ??? https://doi.org/10.1016/0022-0000(89)90034-2 --- # Why should we use higher-order functions? * Simpler interface than objects (which method? which order?) * Can be combined effectively (frameworks on combining functions) --- # A researcher's Petri Dish > Most programming languages features started out in functional programming > languages. * Garbage collection (LISP, 1959) * Generics (Hindley-Milner-Damas type system 1969/1978, [implemented in ML in ~1977](https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.67.5276&rep=rep1&type=pdf) ) * Higher-order functions (`lambda` expressions in C++, C#, Java, Python) introduced in LISP (1959) and in [ISWIM](http://www.cs.cmu.edu/~crary/819-f09/Landin66.pdf) (1966) * Type inference, <i>e.g.</i>, `auto` in C++, `var` in C# (Hindley-Milner-Damas) * Algebraic-data types and pattern matching ([1970s in Hope](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.18.8135&rep=rep1&type=pdf)) * Recursion --- # A new wave of languages > Many new interesting programming languages * Swift: next-generation programming language for Apple systems * Rust: functional programming meets system programming * F#: an ML derivate for the .NET ecosystem * Elixir: highly-available distributed system * Clojure: a LISP-influenced language for the JVM and the web --- # How are we using functional programming ? * [**OCaml:**](http://www.ocaml.org/learn/companies.html) web development (Facebook/Meta), distributed systems (Docker), finance (Tezos, Jane Street, Bloomberg, Aesthetic Integration), hardware virtualization (Citrix) * [**Haskell:**](https://wiki.haskell.org/Haskell_in_industry) verification (Facebook), distributed systems (Google), compilers (Intel), distributed systems (Microsoft) * [**Erlang:**](https://codesync.global/media/successful-companies-using-elixir-and-erlang/) communication (WhatsApp), ads (AddRoll), web backend (Bet365), finance (Goldman Sachs) * [**Elixir:**](https://codesync.global/media/successful-companies-using-elixir-and-erlang/) spam prevention (Pinterest), micro services (Lonely Planet) * [**F#:**](https://fsharp.org/testimonials/) data analysis (Kaggle), trading (Credit Suisse), gaming backend (GameSys) * [**Racket**](https://www.reddit.com/r/Racket/comments/5g8xse/are_there_any_examples_of_racket_being_used_in/) game scripting (Naughty Dog), image processing (YouPatch) * [**Scala**](https://alvinalexander.com/scala/whos-using-scala-akka-play-framework) middleware (Twitter), database (Netflix), microservices (Tumblr), web (The Guardian) ### Honorable mentions * [ReasonML](https://reasonml.github.io/), [Elm](https://elm-lang.org/), [PureScript](http://www.purescript.org/), [ClojureScript](https://clojurescript.org/) --- class: impact # Course overview --- # This course is **NOT**... * .alt[**on algorithms**<br/>] For a nice free book read [Algorithms](http://jeffe.cs.illinois.edu/teaching/algorithms/) by Jeff Erickson. * .alt[**an introduction on programming and computing**] <br/> For a nice free book read [How to design programs](https://htdp.org/2018-01-06/Book/) by Matthias Felleisen, Robert Bruce Findler, Matthew Flatt, Shriram Krishnamurthi * .alt[**on programming with Racket**]<br/> For a nice free book read [The Racket Guide](https://docs.racket-lang.org/guide/) by Matthew Flatt, Robert Bruce Findler, and PLT --- # This course is... * .alt[**on designing programming language features**]<br/> We will focus mainly on functional and object-oriented programming. * .alt[**on semi-formal specification**]<br/> We will drive our course with precise mathematical notations and tests. * .alt[**on programming patterns**]<br/> We will characterize patterns and study abstractions of these patterns. * .alt[**on purely functional programming**]<br/> We will approach programming without using assignment (mutation). --- # Today we will learn * a formalism to describe a programming language (Racket) * the semantics of a programming language ## How we will learn it > We introduce one language feature at a time 1. **Syntax:** We formalize each language feature (What) 2. **Example:** We illustrate a feature with an example 3. **Semantics:** We introduce how each language feature works (How) --- # Semantics - Abstract *Syntax:* how we write something. Example, which characters/string we use write a keyword, or a number. - *Semantics:* what that something does/means (evaluation here means as the program runs) > In this class, we focus on the **semantics** of programming languages. > We define the semantics of some programming language features. --- class: middle, center # 1. We shall *not* print to output! ## Instead, we will use *assertions*. # 2. We shall *not* mutate variables! ## Instead, we will use *persistent data structures*. # 3. We shall *not* use loops! ## Instead, we will use *recursion*. --- class: impact # Your first program --- class: hl-alt # Program In Racket, **.alt[everything evaluates down to or is a value]**. A Racket program consists of a preamble followed by zero or more expressions: .box.code[ .metavar[program] = .lit[\#lang racket] .metavar[expression]* ] 1. Racket has no end-of-sentence delimiters (contrary to, say, C-like languages which use semi-colons) 2. Racket evaluates each expression from top-to-bottom, left-to-right > For space-constraint reasons, code listings might omit the preamble. ### Language specification * .code.lit[Grayed out text] represents the concrete syntax * .code.metavar[Italic text] represents a meta-variable --- # Expressions ## Expressions can be values, among other things .box.code[ .metavar[expression] = .metavar[value] | $`\cdots`$ ] --- # Values - **Numbers** - Void - Booleans - Lists - ... --- class: impact # Numbers --- # Numbers > *All numbers are complex numbers.* Some of them are real numbers, and all > of the real numbers that can be represented are also rational numbers, > except for `+inf.0` (positive infinity), `+inf.f` (single-precision variant), > `-inf.0` (negative infinity), `-inf.f` (single-precision variant), `+nan.0` > (not-a-number), and `+nan.f` (single-precision variant). Among the > rational numbers, some are integers, because round applied to the number > produces the same number. Source: [Racket Manual, Section 4.2](https://docs.racket-lang.org/reference/numbers.html) --- # Hello, Numbers! ## Your first Racket program .col-6[ ```scheme #lang racket 10 ; A positive number +10 ; The plus sign is optional -10 ; A negative number 0+1i ; A complex number 1/3 ; A rational number 0.33 ; A floating-point number ``` ] .col-6[ ```bash $ racket nums.rkt 10 10 -10 0+1i 1/3 0.33 ``` ] > **Note:** a semi-colon (`;`) initiates a comment section, which is ignored in Racket. > A semi-colon is **not** a end-of-line marker, like in C-like languages. --- # Expressions are separated by white-space These two programs are equal: .row[ .col-6[ ```scheme #lang racket 10 +10 -10 0+1i 1/3 0.33 ``` ] .col-6[ ```scheme #lang racket 10 +10 -10 0+1i 1/3 0.33 ``` ] ] **Caveats:** `-1` is different than `-`.code.lit[ ]`1` (notice the white space in between both characters). The former is the negative one, the latter is the expression `-` and the value `1`. Similarly, `1/3` is a single rational number, whereas `1 / 3` are three expressions. --- class: impact # Function calls --- # Function call Delimited by parenthesis and its constituents are separated by white-space characters. The first expression must evaluate to a function, the remaining expressions are the arguments. Each expression is evaluated to a value from left-to-right before applying the function. .box.code[ .metavar[expression] = .metavar[value] | .alt.metavar[variable] | .alt.metavar[function-call] | $`\cdots`$ </br> .metavar[function-call] = .lit[(] .metavar[expression-func] .metavar[expression-arg]* .lit[)] ] For instance, function call `(expt 2 3)`, for exponentiation, returns `2` raised to the power of `3`. Function `sin` computes the sine function of its sole argument. .row[ .col-6[ ```scheme #lang racket (expt 2 3) (sin (expt 2 3)) ``` ] .col-6[ ```bash $ racket nums-func.rkt 8 0.9893582466233818 ``` ] ] .small[ > **Note:** Function calls can be compounded, as the parameters of a function are arguments too. ] --- # No infix notation in Racket There is **NO INFIX NOTATION** for arithmetic operations (unlike most languages). The usual arithmetic operations are all just variables: addition `+`, subtraction `-`, multiplication `*`, division `/`. Example: ```scheme ( * 3.14159 ( * 10 10)) | | | | | | |-> Number | | | | | |-> Number | | | | |-> Variable | | | |-> Function call | | |-> Number | |-> Variable |-> Function call ``` > **Note:** In Racket parenthesis represent function application. Contrasted with most > C-like languages where parenthesis in expressions are optional and only there > to help the reader.