Julia: Lower standalone dotted infix operators as anonymous functions

Created on 19 Dec 2019  Â·  4Comments  Â·  Source: JuliaLang/julia

I could've sworn we already had an issue tracking this, but I couldn't find it. In short, I'd love to have support for standalone (.+) and friends to lower to (args...)->(+).(args...). This would enable their use in higher order functions and generally make them more useful.

They currently parse as identifiers — and can be assigned to! — so this would be a breaking minor change.

broadcast lowering

Most helpful comment

Would it be weird to be able to do e.g. map(.+, a, b) but not map(f., a, b) in general?

All 4 comments

Would it be weird to be able to do e.g. map(.+, a, b) but not map(f., a, b) in general?

It would be nice, at least, to have a non-weird :smile: syntax for that, e.g. broadcast(f). Unfortunately that is already defined to do f(), but that is fairly useless.

Maybe broadcasted(f)?

Unfortunately Base.broadcasted(f) is simply the lazy version of broadcast(f). It's similarly varargs and, when materialized, it also means f().

Was this page helpful?
0 / 5 - 0 ratings

Related issues

m-j-w picture m-j-w  Â·  3Comments

sbromberger picture sbromberger  Â·  3Comments

TotalVerb picture TotalVerb  Â·  3Comments

tkoolen picture tkoolen  Â·  3Comments

omus picture omus  Â·  3Comments