Skip to content

My Solution to the weather problem#2

Open
idarlington wants to merge 4 commits intoLagosScala:masterfrom
idarlington:master
Open

My Solution to the weather problem#2
idarlington wants to merge 4 commits intoLagosScala:masterfrom
idarlington:master

Conversation

@idarlington
Copy link
Copy Markdown

No description provided.

@buddiex
Copy link
Copy Markdown

buddiex commented Mar 4, 2017

done the second task?

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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