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

Implement Lab3 Letter frequency #515

Merged
merged 5 commits into from
Jul 25, 2019

Conversation

sirigithub
Copy link
Collaborator

@sirigithub sirigithub commented Jun 30, 2019

Fixes #516

Review of colleague's PR #

Changes proposed in this PR:

  • Implemented a function letters(s string) that returns a map[rune]int of each letter
  • and its frequency
  • Implemented a function sortLetters(m map[rune]int) that returns sorted slice of strings in the format "letter:frequency"
  • Implemented main method that calls fmt.Println(strings.Join(sortLetters(letters("aba")), "\n")) to print
  • each of the "letter:frequency" in a new line
  • Included tests for all functions with different string inputs.
  • Implemented fixes as per PR review
  • Pushed missing fixes from earlier PR review suggestions.

@codecov
Copy link

codecov bot commented Jun 30, 2019

Codecov Report

Merging #515 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #515   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files         115    116    +1     
  Lines        2024   2038   +14     
=====================================
+ Hits         2024   2038   +14
Impacted Files Coverage Δ
03_letters/sirigithub/main.go 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9b34613...8e37a77. Read the comment docs.

undrewb
undrewb previously approved these changes Jun 30, 2019
Copy link
Collaborator

@undrewb undrewb left a comment

Choose a reason for hiding this comment

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

Consider using short variable names - e.g. characterFreq could be cFreq or even cf. http://doc.cat-v.org/bell_labs/pikestyle and https://www.reddit.com/r/golang/comments/8wxwgv/why_does_go_encourage_short_variable_names/

Consider having a seperate test for letters and renaming TestLetterFrequency to TestSortLetterFrequency

Copy link
Contributor

@camscale camscale left a comment

Choose a reason for hiding this comment

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

This is pretty close to perfect, just a couple of minor comments that I think are worth addressing. Ping me when you've pushed the changes and I'll approve.

03_letters/sirigithub/main_test.go Outdated Show resolved Hide resolved
03_letters/sirigithub/main.go Outdated Show resolved Hide resolved
03_letters/sirigithub/main.go Outdated Show resolved Hide resolved
Copy link
Contributor

@camscale camscale left a comment

Choose a reason for hiding this comment

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

Just one small change from the previous review that was missed, and you're good to go.

03_letters/sirigithub/main.go Outdated Show resolved Hide resolved
@davidbroughsmyth
Copy link
Collaborator

Just notice that you have not added in your PR comments:

Review of colleague's PR #

But otherwise LGTM

Copy link
Contributor

@juliaogris juliaogris left a comment

Choose a reason for hiding this comment

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

LGTM

@sirigithub sirigithub requested a review from samuong as a code owner July 25, 2019 02:11
@sirigithub sirigithub merged commit 386e87f into anz-bank:master Jul 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lab 3:Letter frequency
8 participants