wl icon indicating copy to clipboard operation
wl copied to clipboard

Infix function call support

Open darvin opened this issue 7 years ago • 3 comments
trafficstars

In[1]:= a ~ b ~ c

2018/05/25 23:01:35 System`UnParsed: {Rune:126 Val: pos:7} ExpressionCase(136) &wl.Expression{
· Case: 136,
· Expression: &wl.Expression{
· · Case: 136,
· · Expression: &wl.Expression{
· · · Case: 139,
· · · Token: IDENT, "a",
· · },
· · Expression2: &wl.Expression{
· · · Case: 139,
· · · Token: IDENT, "b",
· · },
· · Token: '~',
· },
· Expression2: &wl.Expression{
· · Case: 139,
· · Token: IDENT, "c",
· },
· Token: '~',
}
exit status 1

Desired behavior:

In[56]:= a ~ b ~ c                                                                               

Out[56]= b[a, c]

darvin avatar May 26 '18 06:05 darvin

This might be best solved in interp.go in the expreduce package, instead of this parser. Perhaps if @cznic sees an easy way to perform this parsing using yacc then we can do it in this package. At least this package still produces a parsed result rather than a syntax error.

corywalker avatar May 28 '18 20:05 corywalker

@corywalker

I'm fine with anything you consider a correct solution. I may become more actionable next week, feel free to push a fix if you have one, thanks.

cznic avatar May 28 '18 21:05 cznic

This might be best solved in interp.go in the expreduce package, instead of this parser.

@corywalker Has the fix as suggested above been implemented and can this issue be closed?

cznic avatar Nov 01 '18 10:11 cznic