Conversation
| | `a==b` | `(call == a b)` | | ||
| | `1<i<=n` | `(comparison 1 < i <= n)` | | ||
| | `a.b` | `(. a (quote b))` | | ||
| | `a.(b)` | `(. a b)` | |
There was a problem hiding this comment.
I removed a.(b) in "Operators" table (here) and mention it as f.(x) in "Calls" table since it seems the documentation does not match with the implementation:
> (julia-parse "a.(b)")
(|.| a (tuple b))|
Does it support dot operators? e.g. |
|
Yes julia> x = .- (1:3)
-1:-1:-3
julia> y = x .^ 2
3-element Array{Int64,1}:
1
4
9
julia> collect(for x .+ sqrt.(y))
3-element Array{Float64,1}:
0.0
0.0
0.0Its parsing and lowering are tested like Lines 1846 to 1847 in 1882eae and Lines 1865 to 1874 in 1882eae Let me know if there are other useful test cases. |
|
So the correct use for iterating would be e.g. The doubling looks weirder than |
|
I would imagine this pattern is less common than reducers (e.g. |
|
Fair enough. But Keno's original proposal in #31088 (comment) brought up exactly the point of lowering |
@chethega Yes, that's correct. But this is not a new design. This is a consequence of what was proposed in the triage. |
|
I feel like it would be better/more explicit a |
|
I've implemented the macro-based solution in #31088 (I used different macro name but renaming it is quite easy). At this point I think it's up to triage to decide and merge the preferable one. |
|
I should mention that the |
I think it does not work well if you want to denote |
|
given the staleness and the controversy about the design in the first place, I think it's fair to close this |
This PR implements
for f.(args...)syntax as discussed in #19198 and planned in #31088 (comment).close #19198
close #31088
Implementation detail
Expr(:fordot, :(broadcasted.(expression)))AST node is introduced to representfor broadcasted.(expression).broadcastedcalls by using the pre-existing code injulia-syntax.scmbut skips the outer-mostmaterializecall.for non(dot(call))is a syntax error at the moment.for non(dot(call))is an error at the moment.Demo