f p = [e | q]
f- = D
in
concatMap f 1
[e | q] = [e | q. True]
primes :: fInteger] | |
primes = map head $ iterate (A (x:xs) -*■ [y | y <- xs, v ‘mod‘ x + | |
0]) [2..] | |
primes :: [Integerl primes = 2 : [n | n <- |
f3..|, MI (A p -* n 'mod‘ p t 0) |
(takeWhie (A p -> p xp < n) primes)] |
też był omówiony i pokazany ...
(X,<B,e)
• łączna: (x ® y) © 2 = x © (y © z)
• ma obustronny element neutralny: e © x = x
x®e = x
class Monoid a where
(xx) :: a -»■ a -»■ a e a
instance Monoid Integer where
(xx) = (+) e = 0
class Show a where show : : a -*■ Show
2