in reply to Re: [Perl 6] Generalized shortcutting C<||>?
in thread [Perl 6] Generalized shortcutting C<||>?

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.

  • Comment on Re^2: [Perl 6] Generalized shortcutting C<||>?