Scala - select elements from ordered list

I am looking for a nice way to remove first N elements which are equal from the ordered list, e.g.


should return

removeSame(list)  -> (1,1,1)

Is there a nice way to do it, rather than remove the head of the list and then use takeWhile on the remainder, and finally using dropwhile? I can think of simple non-functional solution but I was wondering whether any functional one also exists


The functional way to avoid the duplication of takeWhile and dropWhile to get a prefix and remainder is using span, i.e.

scala> val list = List(1,1,1,2,3,3)
list: List[Int] = List(1, 1, 1, 2, 3, 3)

scala> val (prefix, rest) = list span (_ == list.head)
prefix: List[Int] = List(1, 1, 1)
rest: List[Int] = List(2, 3, 3)

Need Your Help

Is it possible to send an SMS with hyperlink and anchor text (hidden URL) on Android device?

android hyperlink sms

I know that the Android Message app can parse URLs that starts with "www" and "http://", making them hyperlinks. But is it possible to send a hyperlink, where only the anchor text is displayed and ...

Swift 'use of undeclared type'

ios swift

i am currently trying to write a little iOS applicationin swift, where I have these Classes: