JuliaLang / julia

The Julia Programming Language
https://julialang.org/
MIT License
45.06k stars 5.44k forks source link

Enable function composition for . fusion operator #21875

Open davidanthoff opened 7 years ago

davidanthoff commented 7 years ago

This would be similar to the way ! and work right now.

For example, map(f., x) would be equivalent to map(i -> f.(i), x).

This would make map work pretty seamlessly with the whole call-site lifting operator as it is implemented right now, i.e. if x is a Array{Nullable{T},N} this would be a natural way to map the lifted version of a function over that array.

yurivish commented 7 years ago

Would f..(x) mean (i -> f.(i)).(x)?

davidanthoff commented 7 years ago

Yes. I'm realizing now that this issue here is essentially subsuming #20502.

JeffBezanson commented 7 years ago

Some languages use .a as short for x -> x.a, which is kind of nice. Could be compatible with this, but just something else to think about around dots.

davidanthoff commented 7 years ago

Some languages use .a as short for x -> x.a, which is kind of nice. Could be compatible with this, but just something else to think about around dots.

And I would very much like that as well :) My understanding of the parser is not good enough to be able to tell whether this could be compatible, I'm afraid...