I'm a bit shaky on the rules as to when you need a _ after a method to use it as a function. For example, why is there a difference between Foo's and Nil's :: in the following?
def square(n: Int) = n * n
object Foo { def ::(f: Int => Int) = f(42) }
// ...
scala> Foo.::(square)
res2: Int = 1764
scala> Nil.::(square)
<console>:6: er...
def mainCaller() = {
val name = "xyz"
someList.foreach { u:Map => foo(name, u) }
}
def foo(name:String)(map:Map): Unit = {
//match case....
//recursive call to foo in each case where name remains same, but map changes
}
how can I write foo as a partially applied function, where I dont have to pass name in every recursive call...
Hello,
in liftbook, there's an example of creating of a Req instance by using apply :
case Req(List("api", "expense", eid), "", GetRequest) =>
() => showExpense(eid)
but when I look into api documentation, there are two apply() methods, but I don't know which one and how is ran in this example.
Also, is there a way, how to include /a...