Front page | perl.perl6.language |
Postings from April 2008
Chained Comparisons ?
Thread Next
From:
John M. Dlugosz
Date:
April 16, 2008 00:50
Subject:
Chained Comparisons ?
Message ID:
12387-11478@sneakemail.com
I know how comparisons are chained in Perl 6. There is a very short section on it in S03.
So, are the operators infix:{'<'} etc. written in the normal way to take two arguments? Then the language transforms A op B op C into A op B AND B op C on an innate level. Does that apply to any user-defined operator with those names? If I want to make my own chained operator, perhaps the curvy ≼, ≽, etc. or make my operator ≧ a synonym for >=, how would I tell the compiler that they belong to the same set of chained operators?
Or, are the operators written in a tricky way, to return an object that encapsulates the original right argument and the proper boolean result, and has forms to take this object as well? IOW, no built-in support.
--John
Thread Next
-
Chained Comparisons ?
by John M. Dlugosz