Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Paradygmaty
- Lab 4
- zadanie 2.6
- module ListaLiczb where
- funkcja [] x = 0
- funkcja lista x = length (filter (>x) lista)
- // w konsoli funkja [2,4,5,6] 3
- zadanie2.7
- module ListaLiczb where
- funkcja [] = (0,0)
- funkcja lista = (length (filter (>0) lista), length (filter (<0) lista))
- //w konsoli funkcja [2,7]
- // w domu 2.8
- Lab 5
- zadanie 2.1
- module ListaLiczb where
- pierwiastek x = until f1 f2 1.0
- where
- y=1
- f1 y = abs(y*y-x) < 0.001
- f2 y = 0.5*(y + (x/y))
- zadanie 2.2
- //pierwszy punkt
- module ListaLiczb where
- calkowanie f a b n = h * sum (map f punkty)
- where
- h = (b-a)/n
- punkty = [a+i*h | i <-[1..n]]
- module ListaLiczb where
- calkowanie f a b n = h * sum (map f punkty)
- where
- h = (b-a)/n
- punkty = [a+i*h | i <-[0..n-1]]
- // DRZEWA
- module Drzewa where
- data DrzewoBinarne a = Lisc a
- | Wezel a (DrzewoBinarne a) (DrzewoBinarne a)
- | Null
- deriving(Show)
- rozmiar Null = 0
- rozmiar (Lisc _) = 1
- rozmiar (Wezel _ leweDrzewo praweDrzewo) = 1 + rozmiar leweDrzewo + rozmiar praweDrzewo
- d = Wezel 1 (Lisc 2) (Lisc 5)
- //rozmiar d
- //let d1 = Wezel 1 (Lisc 4)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement