flatland: add 'within?'

db4
Eduardo Cavazos 2008-12-10 13:54:22 -06:00
parent 9ad51490af
commit 195acdd600
1 changed files with 14 additions and 0 deletions

View File

@ -2,6 +2,7 @@
USING: accessors arrays fry kernel math math.vectors sequences USING: accessors arrays fry kernel math math.vectors sequences
math.intervals math.intervals
multi-methods multi-methods
combinators.short-circuit
combinators.cleave.enhanced combinators.cleave.enhanced
multi-method-syntax ; multi-method-syntax ;
@ -218,3 +219,16 @@ USING: locals combinators ;
cond cond
2array ; 2array ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
GENERIC: within? ( a b -- ? )
METHOD: within? ( <pos> <rectangle> -- ? )
{
[ left to-the-right-of? ]
[ right to-the-left-of? ]
[ bottom above? ]
[ top below? ]
}
2&& ;