My Solution to the weather problem#2
Conversation
|
done the second task? |
ikenna
left a comment
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
There was a problem hiding this comment.
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]) = { |
There was a problem hiding this comment.
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 **/ |
There was a problem hiding this comment.
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. 👍
No description provided.