#Can you have function captures with multiple arguments?
1 messages · Page 1 of 1 (latest)
you can't do it with underscores (only one allowed)
you'll have to do list.index_map(bla, fn(b, c) { do_something(a, b, c) })
alternatively you could do something like this:
pub fn main() {
let wibble = ["a", "b", "c"]
let magic_number = 5
wibble
|> list.index_map(pair.new)
|> list.map(do_something(magic_number, _))
}
fn do_something(a: Int, b: #(String, Int)) {
io.debug(a)
io.debug(b)
}