From e9f2197590f2c785f43818efe2f2c5fc094e598f Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Mon, 2 Feb 2009 16:35:30 -0600 Subject: [PATCH 1/2] remove a couple usings and nrev --- basis/generalizations/generalizations-docs.factor | 10 ---------- basis/generalizations/generalizations.factor | 7 ++----- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/basis/generalizations/generalizations-docs.factor b/basis/generalizations/generalizations-docs.factor index a676be3be8..912f69587e 100644 --- a/basis/generalizations/generalizations-docs.factor +++ b/basis/generalizations/generalizations-docs.factor @@ -139,15 +139,6 @@ HELP: -nrot } } ; -HELP: nrev -{ $values { "n" integer } } -{ $description "A generalization of " { $link spin } " that reverses any number of items at the top of the stack." -} -{ $examples - { $example "USING: prettyprint generalizations ;" "1 2 3 4 4 nrev .s" "4\n3\n2\n1" } - "The " { $link spin } " word is equivalent to " { $snippet "3 nrev" } "." -} ; - HELP: ndip { $values { "quot" quotation } { "n" integer } } { $description "A generalization of " { $link dip } " that can work " @@ -327,7 +318,6 @@ $nl { $subsection nnip } { $subsection ndrop } { $subsection ntuck } -{ $subsection nrev } { $subsection mnswap } "Generalized combinators:" { $subsection ndip } diff --git a/basis/generalizations/generalizations.factor b/basis/generalizations/generalizations.factor index c6a17df099..4692fd20db 100644 --- a/basis/generalizations/generalizations.factor +++ b/basis/generalizations/generalizations.factor @@ -1,8 +1,8 @@ ! Copyright (C) 2007, 2008 Chris Double, Doug Coleman, Eduardo ! Cavazos, Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: kernel sequences sequences.private math math.ranges -combinators macros quotations fry macros locals ; +USING: kernel sequences sequences.private math combinators +macros quotations fry ; IN: generalizations << @@ -51,9 +51,6 @@ MACRO: nnip ( n -- ) MACRO: ntuck ( n -- ) 2 + '[ dup _ -nrot ] ; -MACRO: nrev ( n -- ) - 1 [a,b] [ ] [ '[ @ _ -nrot ] ] reduce ; - MACRO: ndip ( quot n -- ) [ '[ _ dip ] ] times ; From 346a61f4978049689012e9fa84a893d4fa5234cf Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Mon, 2 Feb 2009 16:37:36 -0600 Subject: [PATCH 2/2] slight cleanup in memoize --- basis/memoize/memoize.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/memoize/memoize.factor b/basis/memoize/memoize.factor index 1c31156311..7b8c30c534 100644 --- a/basis/memoize/memoize.factor +++ b/basis/memoize/memoize.factor @@ -35,7 +35,7 @@ M: too-many-arguments summary drop "There must be no more than 4 input and 4 output arguments" ; : check-memoized ( word -- ) - dup #in 4 > swap #out 4 > or [ too-many-arguments ] when ; + [ #in ] [ #out ] bi [ 4 > ] either? [ too-many-arguments ] when ; : define-memoized ( word quot -- ) over check-memoized