new files
This commit is contained in:
parent
3af7344581
commit
86c034bb8b
1364 changed files with 21352 additions and 0 deletions
3
Task/Search-a-list/Scala/search-a-list.scala
Normal file
3
Task/Search-a-list/Scala/search-a-list.scala
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
def findNeedles(needle: String, haystack: Seq[String]) = haystack.zipWithIndex.filter(_._1 == needle).map(_._2)
|
||||
def firstNeedle(needle: String, haystack: Seq[String]) = findNeedles(needle, haystack).head
|
||||
def lastNeedle(needle: String, haystack: Seq[String]) = findNeedles(needle, haystack).last
|
||||
Loading…
Add table
Add a link
Reference in a new issue