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

My Solution to the weather problem #2

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

Conversation

idarlington
Copy link

No description provided.

@buddiex
Copy link

buddiex commented Mar 4, 2017

done the second task?

Copy link
Contributor

@ikenna ikenna left a comment

Choose a reason for hiding this comment

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

Very simple and neat solution 👍 .

Waiting to see you implement the football solution as well and factor out common code.

*/
object DataMunging {

case class weatherLine(
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice touch adding a weatherLine class data type! 👍 .
One tiny thing - Scala Style guide would probably suggest the CamelCase name for weatherLine i.e WeatherLine.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Author

@idarlington idarlington Mar 6, 2017

Choose a reason for hiding this comment

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

Thanks, I decided earlier to I need to put in more effort to using a style guide in coding. Thanks for the correction.

(a.maxTemperature - a.minTemperature) > (b.maxTemperature - b.minTemperature)
}

def main(args: Array[String]) = {
Copy link
Contributor

Choose a reason for hiding this comment

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

I suppose you could extend App instead of having a main method, but thats just a style thing. Whichever style you like is good.

val filename = "weather.dat"
val fileLines = io.Source.fromFile(filename).getLines().toList

/** filter empty lines **/
Copy link
Contributor

Choose a reason for hiding this comment

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

Your solution is nice, simple, elegant. 👍

The comments would be really helpful for guys in our Meetup who are beginners. Though more experienced Scala devs may not need them, as the code itself is quite clear. 👍

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.

3 participants