Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Task 2 <масть, достоинство>
- let a1 = [ ('a',1); ('b',2); ('c',3); ('d',4) ; ('a', 2) ; ('c', 3) ]
- let search A =
- A |> List.filter (fun (x,y) -> x='a') |> List.length
- printf "%A\n" ("Задание 2")
- printf "%d\n\n" (search a1)
- // Task 4
- let x1 = [1; 2; 3; 4; 5; 6]
- let x2 = [ [1;2]; [3;4]; [5;6] ]
- let rec Del = function
- | a::b::c -> a::Del c
- | c -> c
- printf "%A\n" ("Задание 4")
- printfn "%A" (Del x1)
- printfn "%A\n" (Del x2)
- // Task 5
- let y1 = [1; 2; 3; 4; 5; 6; 7]
- let y2 = [10; 11; 12; 13; 14]
- let rec Comb = function
- | (a1::b1, a2::b2) -> a1::a2::Comb (b1, b2)
- | (a1, [] ) -> a1
- | ( [], a2) -> a2
- printf "%A\n" ("Задание 5")
- printfn "%A" (Comb (y1, y2))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement