From 195acdd600587db326277b3e2e26a0959c9ad2f0 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Wed, 10 Dec 2008 13:54:22 -0600 Subject: [PATCH] flatland: add 'within?' --- extra/flatland/flatland.factor | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/extra/flatland/flatland.factor b/extra/flatland/flatland.factor index c98c5a6c57..72d9e50a9d 100644 --- a/extra/flatland/flatland.factor +++ b/extra/flatland/flatland.factor @@ -2,6 +2,7 @@ USING: accessors arrays fry kernel math math.vectors sequences math.intervals multi-methods + combinators.short-circuit combinators.cleave.enhanced multi-method-syntax ; @@ -218,3 +219,16 @@ USING: locals combinators ; cond 2array ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +GENERIC: within? ( a b -- ? ) + +METHOD: within? ( -- ? ) + { + [ left to-the-right-of? ] + [ right to-the-left-of? ] + [ bottom above? ] + [ top below? ] + } + 2&& ;