package blevins.emoticon
object App extends Application {
import Emoticon._
val emoticons: List[Emoticon] =
List(
( ^ _ ^ ) ,
( ^ o ^ ) ,
d ( ^ _ ^ ) b ,
( T _ T ) ,
( Z . Z )
)
for ( f <- emoticons ) { f.print }
}
It outputs the following:
(^_^)
(^o^)
d(^_^)b
(T_T)
(Z.Z)
The contents of the Emoticon object is left as an exercise for the reader. Note that I was unable to do the (-.-)Zzz emoticon, but maybe that is just because I didn't try hard enough.
If this doesn't convince you to return to Java, nothing will...
1 comment:
That's overkill. Scala has plenty of built-in emoticons, such as the vampire pope, for adding to a sequence: +:= or the sad witch, for comparing manifests: <:<
But I see you prefer Eastern-style emoticons, which are more rare in Scala. :/
Post a Comment