You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
~/code/scala squala
Welcome to Scala version 2.10.1-20121203-101839-fd57069a3a (JavaHotSpot(TM) 64-BitServerVM, Java1.6.0_27).
Type in expressions to have them evaluated.
Type:help for more information.
scala>valinit:+ last =List(1, 2, 3)
init:List[Int] =List(1, 2)
last:Int=3
Scala has an elegant way to match the first element of a list, but not the last one. Doing it currently seems fairly awkward:
Instead, Apache ESME has defined the following extractor to be able to match the last element of the list:
Now one can simply do this
Does it make sense to include something like this in the standard library? Perhaps one could think of a more appropriate object name.
This feature request is definitely not of high priority.
The text was updated successfully, but these errors were encountered: