package main.scala
package foo
package object bar {
def processListTail(lst: List [Int], func: (Int) => Int): List[Int] =
{
@tailrec def processListAccTail(__list: List[Int], acc: List[Int]): List[Int] =
{
if (__list == Nil) acc
else processListAccTail(__list.tail, func(__list.head) :: acc)
}
processListAccTail(lst, Nil).reverse
}
def sumListFirstPrevious(lst: List[Int]): List[Int] =
{
def sumListAcc(__list: List[Int], acc: List[Int]): List[Int] =
{
if (__list == Nil) acc
else sumListAcc(__list.tail, __list.head + (if(acc == Nil) 0 else acc.head) :: acc)
}
sumListAcc(lst, Nil).reverse
}
def processFindStudent(lst: List[Student]) =
{
students.filter(s => s._3 < 1993).map(s => (s._2, s._4))
}
def groupStudent(roomsWithStudent:List[(String, Int, Int)]) ={
roomsWithStudent.groupBy(x => x._3)
}
package
foo.bar}