Re: [scala-functional] Need help with calling and returning value from anon function in scala

2019-05-07 Thread Steven Parkes
The issue is here is that the `onComplete` call is async (assuming https://github.com/daggerrz/druid-scala-client is the library you're using) It looks like `DruidClient#apply` returns a `Future`:

Re: [scala-functional] Need help with calling and returning value from a function in scala

2019-05-07 Thread tushar pandit
Ok. Thanks for clarifying On Tuesday, May 7, 2019 at 9:28:20 PM UTC-5, jed.wesleysmith wrote: > > this is a moderated forum to prevent spam, you are now authorised to post > > On Wed, 8 May 2019 at 12:20, tushar pandit > wrote: > >> Yeah sorry. Somehow mty questions were not getting posted and

Re: [scala-functional] Need help with calling and returning value from anon function in scala

2019-05-07 Thread Jed Wesley-Smith
Scala is an expression oriented language, so the last thing you refer to is returned. def foo: Int = 3 returns 3. There is no need to use the return keyword, indeed its use can complicate matters as you can create non-local returns, which I suspect is what is confusing you in your example.

Re: [scala-functional] Need help with calling and returning value from a function in scala

2019-05-07 Thread tushar pandit
Yeah sorry. Somehow mty questions were not getting posted and accidentally I clicked twice. It got posted three hours later. Sorry about that. On Tuesday, May 7, 2019 at 9:14:53 PM UTC-5, jed.wesleysmith wrote: > > Tushar, this is a duplicate question. Please see the other one for a > response,

Re: [scala-functional] Need help with calling and returning value from anon function in scala

2019-05-07 Thread tushar pandit
now I need to return* this object On Tuesday, May 7, 2019 at 9:18:26 PM UTC-5, tushar pandit wrote: > > Yeah. I am sorry to put it in a confusing manner. Yeah I am working with > Druid in Scala, but my question is about Scala code itself. So consider I > get some data from some data store (in

Re: [scala-functional] Need help with calling and returning value from anon function in scala

2019-05-07 Thread tushar pandit
Yeah. I am sorry to put it in a confusing manner. Yeah I am working with Druid in Scala, but my question is about Scala code itself. So consider I get some data from some data store (in my case it is Druid), I get the dataset in an object and now I need to pass this object to the calling

Re: [scala-functional] Need help with calling and returning value from a function in scala

2019-05-07 Thread Jed Wesley-Smith
Tushar, this is a duplicate question. Please see the other one for a response, and please try not to double post if possible, thanks! On Wed, 8 May 2019 at 12:06, tushar pandit wrote: > Hi, > > I am trying to call function fetchFromDruid > > def main(args: Array[String]): Unit = { > val res =

Re: [scala-functional] Need help with calling and returning value from anon function in scala

2019-05-07 Thread Jed Wesley-Smith
Tushar, this seems to be an issue with whatever Druid is. This mailing list is for questions about Functional Programming in Scala, both in general and more specifically the book with that title. If you ask your question in a more relevant forum somebody may be able to provide you with an answer.

[scala-functional] Need help with calling and returning value from a function in scala

2019-05-07 Thread tushar pandit
Hi, I am trying to call function fetchFromDruid def main(args: Array[String]): Unit = { val res = fetchFromDruid() // res comes as null here } def fetchFromDruid(): GroupByResponse { implicit val executionContext = ExecutionContext.Implicits.global val client =