small extension to `...` notation

In Haskell we write `f` in order to infixify the identifier f. In ABC the stuff between backquotes is not limited to an identifier, but any expression may occur there. This would allow one to write e.g. xs `zipWith (+)` ys In general <expr1> `<expr2>` <expr3> => (<expr2>) <expr1> <expr3> I think it is a small extension to Haskell, which does not break anything existing, and provides yet another opportunity to beautify one programs, especially in combination with programs like lhs2TeX. Doaitse Swierstra

On Wed, 8 Mar 2006, Doaitse Swierstra wrote:
In Haskell we write `f` in order to infixify the identifier f. In ABC the stuff between backquotes is not limited to an identifier, but any expression may occur there. This would allow one to write e.g.
xs `zipWith (+)` ys
In general <expr1> `<expr2>` <expr3> => (<expr2>) <expr1> <expr3>
I think it is a small extension to Haskell, which does not break anything existing, and provides yet another opportunity to beautify one programs, especially in combination with programs like lhs2TeX.
There is one problem with this: it doesn't nest, you can't tell an opening from a closing backquote, which can cause problems when transforming or rearranging code. Possibly `(<expr>)` and the existing `<identifier>`? -- flippa@flippac.org 'In Ankh-Morpork even the shit have a street to itself... Truly this is a land of opportunity.' - Detritus, Men at Arms

Philippa Cowderoy wrote:
On Wed, 8 Mar 2006, Doaitse Swierstra wrote:
xs `zipWith (+)` ys
There is one problem with this: it doesn't nest [...]
Another problem is that it's not clear how to declare the fixity of these things. Should they always have the default fixity? Should they be required to have the form `<ident> <args>` and use the fixity of `ident`? Neither approach seems very clean. -- Ben

Ben,
xs `zipWith (+)` ys
Another problem is that it's not clear how to declare the fixity of these things. Should they always have the default fixity? Should they be required to have the form `<ident> <args>` and use the fixity of `ident`? Neither approach seems very clean.
Following Philippa's suggestion to handle nesting, one could again treat `<ident>` and `<non-indent-expr>` differently and always assume the latter is given infix 9. Regards, Stefan

Hello Doaitse, Thursday, March 9, 2006, 12:01:37 AM, you wrote: DS> xs `zipWith (+)` ys i had the same desire several times
Possibly `(<expr>)` ?
it will be non-readable. it is better to just prohibit using of backquotes inside backquotes. and fixity can be fixed at 0, imho. at least, my cases was just when i want to use two words inside backquotes instead of just one. and fixity should be 0 because such expression with space inside it should have a small priority because parts of expression "too distant" from each other (btw, i had (not serious) proposal to raise priority of operations if there is no spaces around it, so that the following: x:xs ++ y:ys translates to (x:xs)++(y:ys) in full accordance with natural reading) -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

On Thursday 09 March 2006 08:59, Bulat Ziganshin wrote:
Hello Doaitse,
Thursday, March 9, 2006, 12:01:37 AM, you wrote: DS> xs `zipWith (+)` ys
i had the same desire several times
Possibly `(<expr>)` ?
it will be non-readable. it is better to just prohibit using of backquotes inside backquotes. and fixity can be fixed at 0, imho.
at least, my cases was just when i want to use two words inside backquotes instead of just one. and fixity should be 0 because such expression with space inside it should have a small priority because parts of expression "too distant" from each other
(btw, i had (not serious) proposal to raise priority of operations if there is no spaces around it, so that the following:
x:xs ++ y:ys
translates to
(x:xs)++(y:ys)
in full accordance with natural reading)
I support this. BTW, it reminds me of the language L, where there are 3 'symbols' for application, each with a different precedence: "A sequence of expressions separated by nothing, periods, or spaces denotes an application (function call) where the function is the result of the first expression and the arguments are the results of the remaining expressions. The expressions are computed independently in parallel. No separation has highest precedence, then period separation, then space separation. Parenthesis can be used to override precedence. Example application expressions are: x+2, x.+.2, x + 2, x + 4y, (x + 4)y + foo.bar." (Quoted from http://www-static.cc.gatech.edu/~tony/L/) Ben

Some questions were raised. Let me start withbynoticing that all I am interested in is a very small extensions, without creating more problems than solving, so I could perfectly live with: - no `...` inside `...`. If you really need this you use parentheses - the first element between the `...` should be an identifier, and the operator takes the properties of this identifier. With respect to the last remark: this makes it clear that I am really passing arguments to the identifier, which would otherwise stand alone between the `...`'s. Everything else remains the same, Doaitse On 2006 mrt 09, at 8:59, Bulat Ziganshin wrote:
Hello Doaitse,
Thursday, March 9, 2006, 12:01:37 AM, you wrote: DS> xs `zipWith (+)` ys
i had the same desire several times
Possibly `(<expr>)` ?
it will be non-readable. it is better to just prohibit using of backquotes inside backquotes. and fixity can be fixed at 0, imho.
at least, my cases was just when i want to use two words inside backquotes instead of just one. and fixity should be 0 because such expression with space inside it should have a small priority because parts of expression "too distant" from each other
(btw, i had (not serious) proposal to raise priority of operations if there is no spaces around it, so that the following:
x:xs ++ y:ys
translates to
(x:xs)++(y:ys)
in full accordance with natural reading)
-- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com
participants (6)
-
Ben Rudiak-Gould
-
Benjamin Franksen
-
Bulat Ziganshin
-
Doaitse Swierstra
-
Philippa Cowderoy
-
Stefan Holdermans