Newbie scala question.
Considering the example in http://docs.scala-lang.org/sips/pending/futures-promises.html val
rateQuote = future {
connection.getCurrentValue(USD)
}
val purchase = rateQuote map {
quote => if (isProfitable(quote)) connection.buy(amount, quote)
else throw new Exception("not profitable")
}
purchase onSuccess {
case _ => println("Purchased " + amount + " USD")
}
How could i access quote variable in purchase onSuccess, eg:
purchase onSuccess {
case _ => println("Purchased " + amount + " USD for quote" + quote)
}
I could simply assign it in map to some global variable.. but?