Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let listaPrzystychIPodzielnychPrzez3 (lista:int list) =
- let rec dodajDoListy lista element =
- match lista with
- | [] -> [element]
- | head :: tail -> (head::element::tail)
- let rec parzyste (lista:int list) (lParzyste:int list) =
- match lista with
- | [] -> lParzyste
- | head :: tail -> if head % 2 = 0
- then
- parzyste tail (dodajDoListy lParzyste head)
- else
- parzyste tail lParzyste
- let rec podzielne lista lPodzielne =
- match lista with
- | [] -> lPodzielne
- | head :: tail -> if head % 3 = 0
- then
- podzielne tail (dodajDoListy lPodzielne head)
- else
- podzielne tail lPodzielne
- (parzyste lista ([]:int list), podzielne lista ([]:int list))
- listaPrzystychIPodzielnychPrzez3 [1; 2; 3; 4; 5; 6; 7; 8; 9; 12]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement