Hi Kaj, thanks for your question, it served me as inspiration to add another example to the manual: https://cubajl.readthedocs.org/en/latest/#passing-data-to-the-integrand-function
Bye, Mosè 2016-04-13 5:14 GMT+02:00 Steven G. Johnson <stevenj....@gmail.com>: > > > On Tuesday, April 12, 2016 at 4:51:07 PM UTC-4, Kaj Wiik wrote: >> >> Very nice work indeed! >> >> Is it possible to pass 'userdata' to integrand in Julia? It is mentioned >> in sources but is not listed in keywords. >> > > You don't need an explicit userdata argument -- this is just a crude > simulation of closures in C, but Julia has true closures and lexical > scoping. > > For example > > > myvar = 7 > Vegas( (x,f) -> f[1] = log(x[1] + myvar)/sqrt(x[1]), 1, 1) > > > will "capture" the value of myvar and pass it through Vegas to the > integrand, via the closure. >