Skip to content

Conversation

@aapakhomov
Copy link

No description provided.

@alexeyr
Copy link
Owner

alexeyr commented Mar 29, 2024

Сделайте свой репозиторий приватным, пожалуйста.

intersect [] _ = []
intersect (x:xs) (y:ys)
| x == y = [x] ++ intersect xs ys
| otherwise = intersect xs ys
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Я не вижу, как у вас проходит тест

intersect [1, 2, 3] [3, 4, 5] `shouldBe` [3]

У меня там получается пустой список с такой реализацией. Первый пример в задании тоже не должен работать.

@alexeyr
Copy link
Owner

alexeyr commented Mar 29, 2024

Кроме ошибки в intersect, всё остальное отлично. Ставлю 18, её можно исправить и получить 20.

@aapakhomov aapakhomov changed the title complete lab 1 labs Aleksei Pakhomov Jun 3, 2024
@alexeyr
Copy link
Owner

alexeyr commented Jun 25, 2024

Можете лабораторные 2 и 3 вынести в отдельные PR?

Comment on lines +12 to +32
coprime :: Integer -> Integer -> Bool
coprime a b
| c == 0 || d == 0 = False
| c == 1 || d == 1 = True
| c > d = coprime (c - d) d
| otherwise = coprime (d - c) c
where c = abs a
d = abs b

max3, median3 :: Integer -> Integer -> Integer -> Integer
max3 x y z = if max x y >= z then max x y else z
median3 x y z = if max x y >= z then (if x >= y then max y z else max x z) else max x y

newtype Poly a = Poly [a]
xPows x = map (\n -> x**n) [0..]
getCoefs (Poly p) = p
discardZeroes [] = []
discardZeroes p = if (last p /= 0) then p
else discardZeroes $ init p
makePoly p x = sum $ zipWith (*) (getCoefs p) (xPows x)
applyPoly p x = makePoly p x
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Сами функции добавили, а тесты для них нет.

@alexeyr
Copy link
Owner

alexeyr commented Jun 25, 2024

Можете лабораторные 2 и 3 вынести в отдельные PR?

Уже не надо, я посмотрел изменения с последней проверки.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants