Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lab3 Rudnevskiy #10

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Lab3 Rudnevskiy #10

wants to merge 3 commits into from

Conversation

helytpro
Copy link

@helytpro helytpro commented Jun 3, 2024

No description provided.

(==) = undefined
(==) (P a) (P b) = checkNull a == checkNull b where
checkNull [] = []
checkNull lst = if (last lst == 0) then checkNull (init lst) else lst
Copy link
Owner

Choose a reason for hiding this comment

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

Это очень неэффективная реализация из-за медленных last и init, но ладно.

Comment on lines +27 to +34
it "xor" $ do
xor True True `shouldBe` False
xor True False `shouldBe` True
xor False True `shouldBe` True
xor False False `shouldBe` False
it "geomProgression" $ do
geomProgression 5.0 0.5 2 `shouldBe` 1.25
geomProgression 5.0 2.0 3 `shouldBe` 40.0
Copy link
Owner

Choose a reason for hiding this comment

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

Функции добавили и QuickCheck раскомментировали, но тесты-то без QuickCheck! Из-за своей задержки я поставлю полный балл с возможностью его увеличить, добавив тесты в QuickCheck.

Comment on lines 92 to +104
{- -O0: Total time: ??? Total Memory in use: ??? -}
{- -O2: Total time: ??? Total Memory in use: ??? -}
minMax = undefined
minMax [] = Nothing
minMax (x:xs) = Just (foldl update (x, x) xs) where
update (minVal, maxVal) current = (min minVal current, max maxVal current)

-- Дополнительное задание: реализуйте ту же самую функцию (под названием minMaxBang) с
-- использованием явной строгости (seq и/или !)

{- -O0: Total time: ??? Total Memory in use: ??? -}
{- -O2: Total time: ??? Total Memory in use: ??? -}
minMaxBang = undefined
minMaxBang [] = Nothing
minMaxBang (x:xs) = Just (foldl (\(mn, mx) y -> (min mn y, max mx y)) (x, x) xs)
Copy link
Owner

Choose a reason for hiding this comment

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

Это та же реализация, что выше, только с другими названиями переменных, без seq и без !.

@alexeyr
Copy link
Owner

alexeyr commented Jun 25, 2024

Тут замечания есть, но я поставлю полные баллы за 2 и 3 лабораторные, и при исправлении можно ещё увеличить.

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