I'd be happy to have a feature of calling 2-arg function [func a b] using (a`func`b) infix notation. I suppose, adding this syntax would be easier than full-scale infix operators support suggested by Ziv, and could be a starter point for the larger-scale work.
Regards, Sergey 2015-02-20 5:58 GMT+03:00 Ziv Scully <[email protected]>: > Both these function combinators and more concise operators for sources would > be encompassed by user-defined infix operators. I expect this would be more > work than the proposed patch, but if the demand for infix operators is high > enough, I think this would be better than an ever-expanding unconfigurable > hodgepodge of built-in operators. > > On Thu, Feb 19, 2015 at 9:46 PM, Timothy Beyer <[email protected]> wrote: >> >> At Thu, 19 Feb 2015 18:34:49 +0000 (UTC), >> Gabriel Riba wrote: >> > >> > Adam Chlipala <adamc <at> csail.mit.edu> writes: >> > >> > > >> > > OK, I see. By "functional," you meant "related to function >> > > application, >> > > composition, etc.", not a general mechanism for introducing new infix >> > > operators. >> > > >> > > If you (or anyone else) want to experiment with tweaking src/urweb.grm >> > > to add some new operators, I'll be happy to accept a patch embodying >> > > tasteful choices. :) (May also require adding to lib/ur/top.ur[s] new >> > > definitions of conventionally named functions, to which the new >> > > operators desugar.) >> > > >> > >> > Hello! >> > >> > I've worked out a solution for the function application and composition >> > operators, after revising the mlton manuals for ml-lex and ml-yacc, and >> > it >> > works. >> > >> > I need your opinion to ensure if it is complete. >> > >> > The operators in this trial are >> > >> > (<|) : forward application (right associative), named FWDAPP in .lex and >> > .grm >> > (|>) : reverse application (left associative), named REVAPP >> > (<<<) : right-to-left composition (right associative) (equivalent to >> > ML's >> > (o)), named COMPOSE >> > (>>>) : left-to-right composition (right associative), named ANDTHEN >> >> I can't speak for Adam, but I've wanted infix apply and compose operators >> in Ur/Web for a while, so I'm looking forward to trying this patch. >> >> If Ur/Web ever gains pattern matching on a function level (eg. without >> requiring an extra case statement), plus pattern matching extensions such as >> OR patterns, and more concise operators for sources, then it would be >> absolute bliss for me, even though what I suggest is quite a lot of >> syntactic sugar. >> >> Regards, >> Tim >> >> _______________________________________________ >> Ur mailing list >> [email protected] >> http://www.impredicative.com/cgi-bin/mailman/listinfo/ur > > > > _______________________________________________ > Ur mailing list > [email protected] > http://www.impredicative.com/cgi-bin/mailman/listinfo/ur > _______________________________________________ Ur mailing list [email protected] http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
