faktori :: Int->[Int] faktori n = [x | x<-[1..n], n `mod` x ==0] prostifakt :: Int->[Int] prostifakt n = [x | x<-[1..n], n `mod` x == 0, [i | i<-[2..x-1], x `mod` i ==0]==[]] prostibr :: Int->[Int] prostibr n = [x | x<-[1..n], [i | i<-[2..x-1], x `mod` i ==0]==[]] unzip1 :: [(a,b)]->([a],[b]) unzip1 [] = ([],[]) unzip1 (x:xs) = ((fst x):(fst (unzip1 xs)), (snd x):(snd (unzip1 xs))) unzip2 :: [(a,b)]->([a],[b]) unzip2 [] = ([],[]) unzip2 ((a,b):xs) = (a:(fst (unzip1 xs)), b:(snd (unzip1 xs))) unzip3 :: [(a,b)]->([a],[b]) unzip3 [] = ([],[]) unzip3 ((a,b):xs) = (a:(fst temp), b:(snd temp)) where temp = (unzip1 xs) qsort :: Ord a => [a]->[a] qsort [] = [] qsort (x:xs) = (qsort l1) ++ [x] ++ (qsort l2) where l1 = [a | a<-xs, a<=x] l2 = [a | a<-xs, a>x]