Open
Conversation
DedSec256
approved these changes
May 17, 2022
| let addTest () = | ||
| let book = addPhone "Oleg" "12345" book | ||
|
|
||
| book |> should contain {Name = "Oleg"; Phone = "12345"} |
There was a problem hiding this comment.
здесь было бы лучше проверить весь справочник. Вдруг addPhone перетирает остальные записи?
Phonebook/Phonebook/Program.fs
Outdated
| let command = getCommand () | ||
| match command with | ||
| | "0" -> () | ||
| | "1" -> addPhone (getName ()) (getPhone ()) book |> program |
There was a problem hiding this comment.
было бы немного читабельнее
Suggested change
| | "1" -> addPhone (getName ()) (getPhone ()) book |> program | |
| | "1" -> book |> addPhone (getName ()) (getPhone ()) |> program |
Phonebook/Phonebook/PhonebookFunc.fs
Outdated
| // поиск имени по телефону | ||
| let rec findNameByPhone phone (book : BookOfNumber list) = | ||
| let getFirst ({Name = a; Phone = b} : BookOfNumber) = a | ||
| book |> List.filter (fun {Name = _; Phone = x} -> x = phone) |> List.map(getFirst) |
There was a problem hiding this comment.
Можно записать так
Suggested change
| book |> List.filter (fun {Name = _; Phone = x} -> x = phone) |> List.map(getFirst) | |
| book |> List.filter (fun {Phone = x} -> x = phone) |> List.map(fun {Name = x} -> x) |
Comment on lines
+25
to
+28
| let person (book : BookOfNumber list) = book.Head | ||
| if (not(book |> List.isEmpty)) then | ||
| printf "%s %s\n" (person book).Name (person book).Phone | ||
| printAll book.Tail |
There was a problem hiding this comment.
проще было бы через паттерн-матчинг со списком записать
DedSec256
approved these changes
Jun 1, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.