Beni Cherniavsky-Paskin: > I was about to second "if in doubt, use nfx", but then thought of scheme > varargs.I feels nice that we can define "operators" using infix syntax: > define {a @ b} ...
I agree, that is awesome. To be honest, I hadn't realized that at first. Many languages that let you *define* new infix operators still require you to use prefix form when *defining* them, and I was using blinders from other languages. Alan Manuel Gloria was the first person who "did the obvious thing" and used curly-infix to *define* an infix operator. Once you see it, you realize how much you want it :-). > but then, why not variadic operators: > define {a ! . rest} strings-join {a cons rest} "!" > {"bang" ! "paths" ! "are" ! "archaic"} > A trickier question is what if I'm ok with 0 argument - can I > spell (define (! . rest) ..) in an infix way?The "obvious" extension is: > define {. ! rest} ... > but that's really bogusweird. Under my current proposal, no. For a simple infix list you have to have at least 3 parameters in the original list, and if there's an improper list, its parameter doesn't count in the length. Also, the "." begins an improper list... as with any list, you must exactly one and only parameter after the bare ".". But if you're defining an infix operator that can 0 or more parameters, I'll argue that what you're *REALLY* defining is an operator that can sometimes be used as infix, and at other times is used with prefix notation. At that point, better to use prefix notation for its definition: (define !( . rest) ... A separate issue: If you're using *sweet* expressions, a symbol beginning with "!" can be slightly awkward; you have to escape it if you *begin* a list with it (it's an indent character). This is irrelevant for: quantify !(a) but matters a lot for: if {x > y} !(x) ; WHUPS! 0 --- David A. Wheeler ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Readable-discuss mailing list Readable-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/readable-discuss