If you're interested in functional programming, you might also want to checkout my second blog which i'm actively working on!!

Thursday, March 25, 2010

the beauty of control abstractions in SCALA - part 2

Ok... after i got my first sample working i was keen on further abstracting the code.

Thanks to excellent input from Luc Duponcheel and Tony Morris the following code shows how you can further abstract the previous article with the help of implicits.


TraversableComponent.scala:


FileComponent.scala


FileComponentTest.scala


Now the only thing missing is a predicate which will be used to determine if the file should be printed or not....

some use case...
if file-extension is .xml
if filename contains "test"


To be continued....

No comments:

Post a Comment