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

Hw3 #12

Merged
merged 7 commits into from
Mar 3, 2025
Merged

Hw3 #12

merged 7 commits into from
Mar 3, 2025

Conversation

GrigorySmirnovSpb
Copy link
Owner

Новая ветка HW3. Исправил тип MyList и добавил новые тесты для него.

Test/TestsHw3.fs Outdated
[<Fact>]
let MergeTest () =
let expected = List.sort []
let mutable lst = MyList.fromList []
Copy link
Collaborator

Choose a reason for hiding this comment

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

А зачем ему быть изменяемым?

Test/TestsHw3.fs Outdated
[<Fact>]
let BubbleTest () =
let expected = List.sort []
let mutable lst = MyList.fromList []
Copy link
Collaborator

Choose a reason for hiding this comment

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

И тут тоже.

match list with
| Empty -> Empty
| Cons (pivot, tail) ->
let less = fromList (List.filter (fun x -> compare x pivot < 0) (toList tail))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Конврттировать туда-обратно --- плохая затея. Много лишних телодвижений.

match list with
| Empty -> Empty
| Cons (elem, tl) when func elem -> Cons (elem, filter func tl)
| Cons (elem, Empty) when func elem = false -> Empty
Copy link
Collaborator

Choose a reason for hiding this comment

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

Реально надо писать прям = false? Просто логически выражением не обойтись?

@GrigorySmirnovSpb GrigorySmirnovSpb merged commit dcf91f9 into main Mar 3, 2025
2 checks passed
@GrigorySmirnovSpb GrigorySmirnovSpb deleted the HW3 branch March 3, 2025 19:03
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