-
Notifications
You must be signed in to change notification settings - Fork 0
hw 1 #1
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
base: master
Are you sure you want to change the base?
hw 1 #1
Conversation
DedSec256
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Есть небольшие замечания, после которых задачи можно зачесть
hw1/hw1/Program.fs
Outdated
| if list = [] then | ||
| raise(ArgumentException("")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
учитывая проверки двумя строками ниже, этот кусок кода избыточен (:
hw1/hw1/Program.fs
Outdated
| if list = [] then | ||
| raise(ArgumentException("Нет такого элемента в списке")) | ||
| if List.head list = number then | ||
| i | ||
| else | ||
| findElement (List.tail list) number (i + 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
тут лучше использопать паттерн-матчинг для списков
hw1/hw1/Program.fs
Outdated
| if List.length list = 0 then | ||
| [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Во-первых, для определения длины выполняется полный проход по списку.
Во-вторых, этот код избыточен, ибо такая же проверка выполняется двумя строками ниже.
hw1/hw1/Program.fs
Outdated
|
|
||
| let fibonacci n = | ||
| if n < 0 then | ||
| raise (ArgumentException"n должно быть неотрицательным") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Кто украл пробел?
| raise (ArgumentException"n должно быть неотрицательным") | |
| raise (ArgumentException "n должно быть неотрицательным") |
hw1/hw1/Program.fs
Outdated
| if list = [] then | ||
| listNew | ||
| else | ||
| reverseListMaker (List.tail list) ((List.head list) :: listNew) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
тут лучше использопать паттерн-матчинг для списков
DedSec256
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
No description provided.