Much belatedly, I came up with this function that I think you will find appealing.

But of course! Except that as you can easily understand, I wanted something more "builtin" and more disguised as an operator, with the condition in the middle. I understand perfectly well that the general consensus does not seem to agree with my own desire so I will refrain from insisting. Most probably(*) in Perl 6 the corresponding function could be coded as a macro with the same syntax as the one I devised, so perhaps it will be interesting to test it "on the field" one day.

(*) I'm not sure because Synopsis 6 specifies the syntax to define infix, prefix, postfix, circumfix and postcircumfix custom operators. But there does not seem to be any means to specify more generic ones, e.g. ternary ones. This may well be the subject of another thread.


In reply to Re^2: [Perl 6] Generalized shortcutting C<||>? by blazar
in thread [Perl 6] Generalized shortcutting C<||>? by blazar

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.