https://kotlinlang.org logo
#announcements
Title
# announcements
d

deinspanjer

05/25/2017, 4:07 PM
Here is an example of what I’m trying to do: https://gist.github.com/deinspanjer/8a677933f5b85135b05a597c7fbc298c
d

dalexander

05/25/2017, 4:38 PM
deinspanjer: A couple of things: one is that it’s easier for people to help you if you paste code inline with triple backticks (`x3) (if you have a lot of code to paste, you can use command-enter). If you need to return a reference to a function, you can always return a new lambda that has the same signature and just calls the function you really want to call. For example:
Copy code
fun example(s: String): String {
  return doSomethingWithS(s)
}

//effectively returns a method reference to "example"
fun returnsClosure(): (String) -> String {
  return { s: String -> example(s) }
}
👍 2
I’m still not completely clear on what you are trying to do so if you have a more specific question about syntax I’ll try and answer, you may also want to check out the #getting-started channel.
d

deinspanjer

05/25/2017, 5:15 PM
Thank you!
2 Views