MI-AFP / tutorials

Materials for MI-AFP course tutorials
https://ccmi.fit.cvut.cz/en
Creative Commons Attribution Share Alike 4.0 International
12 stars 2 forks source link

B172 typos, errors, and enhancements #10

Closed MarekSuchanek closed 6 years ago

MarekSuchanek commented 6 years ago

B172 Errata + additions

Mistakes of B172 materials to be fixed

01

02

03

04

05

06

07

08

09

10

klememi commented 6 years ago

In tutorial 05, subsection Own operators, in example

Prelude> (+) 5 7
12
Prelude> 7 `div` 2
3
Prelude> foo x y z = x * (y + z)
Prelude> (5 `foo` 3) 12
65

last result is wrong (should be 75).

also, in example below

Prelude> (><) xs ys = reverse xs ++ reverse ys
Prelude> (><) "abc" "xyz"
"zyxcba"
Prelude> "abc" >< "xyz"
"zyxcba"
Prelude> :info (><)
(><) :: [a] -> [a] -> [a]

zyxcba is wrong (should be cbazyx)