1 ! Copyright (C) 2008, 2009 Slava Pestov.
2 ! See https://factorcode.org/license.txt for BSD license.
3 USING: assocs combinators math math.intervals math.order ;
4 IN: compiler.tree.comparisons
6 ! Some utilities for working with comparison operations.
8 CONSTANT: comparison-ops { < > <= >= u< u> u<= u>= }
10 CONSTANT: generic-comparison-ops { before? after? before=? after=? }
12 : assumption ( i1 i2 op -- i3 )
20 { \ u<= [ assume<= ] }
21 { \ u>= [ assume>= ] }
24 : interval-comparison ( i1 i2 op -- result )
28 { \ <= [ interval<= ] }
29 { \ >= [ interval>= ] }
30 { \ u< [ interval< ] }
31 { \ u> [ interval> ] }
32 { \ u<= [ interval<= ] }
33 { \ u>= [ interval>= ] }
36 : swap-comparison ( op -- op' )
48 : negate-comparison ( op -- op' )
60 : specific-comparison ( op -- op' )