let filename2length = name => {
let match = %re("/(\d+)([A-Za-z]+)/")->Js.Re.exec_(name)
Option.map(match, Js.Re.captures)->ignore
None
}
In your 2nd function, you passed Option.map a function with no argument–that is why you are getting the complier error: “This function is a curried function where an uncurried function is expected”. Option.map needs a function that takes an argument, which is why your 1st function worked. When I do this for your 2nd function:
let filename2length2 = name => {
let match = %re("/(\d+)([A-Za-z]+)/")->Js.Re.exec_(name)
Option.map(match, Js.Re.captures(_))->ignore
None
}
It gives Javascript that will produce the same result as your first function.