Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let rec odejmijWielomianyPom w1 w2 =
- match w1, w2 with
- | [], n2::tail2 -> [n2]@(odejmijWielomianyPom [] tail2)
- | n1::tail1, [] -> [n1]@(odejmijWielomianyPom tail1 [])
- | [], [] -> []
- | n1::tail1, n2::tail2 -> [n1+n2]@(odejmijWielomianyPom tail1 tail2)
- let odejmijWielomiany w1 w2 =
- let w1n = List.rev w1
- let w2n = List.rev w2
- let result = odejmijWielomianyPom w1n w2n
- List.rev result
- let rec wielomian1 = [2; 3; 0; 0; -1] //2x^4+3x^3-1
- let rec wielomian2 = [1; -1] //0x^4+0x^3+0x^2+x-1
- printfn "%A" (odejmijWielomiany wielomian1 wielomian2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement