From 37f991420b8242ac0516c8533ae0d205556f1a03 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Mon, 24 Nov 2008 22:01:33 -0600 Subject: [PATCH 1/2] fix load error --- extra/webapps/wee-url/wee-url.factor | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extra/webapps/wee-url/wee-url.factor b/extra/webapps/wee-url/wee-url.factor index e4a4a6a853..af7c8b61ce 100644 --- a/extra/webapps/wee-url/wee-url.factor +++ b/extra/webapps/wee-url/wee-url.factor @@ -4,7 +4,8 @@ USING: math.ranges sequences random accessors combinators.lib kernel namespaces fry db.types db.tuples urls validators html.components html.forms http http.server.dispatchers furnace -furnace.actions furnace.boilerplate furnace.redirection ; +furnace.actions furnace.boilerplate furnace.redirection +furnace.utilities ; IN: webapps.wee-url TUPLE: wee-url < dispatcher ; From de957735744620132c63e3291ce2f96d2a507ab5 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Tue, 25 Nov 2008 05:55:49 -0600 Subject: [PATCH 2/2] generalizations: Update 'npick' to not use >r and r> --- basis/generalizations/generalizations.factor | 141 ++++++++++--------- 1 file changed, 73 insertions(+), 68 deletions(-) diff --git a/basis/generalizations/generalizations.factor b/basis/generalizations/generalizations.factor index c63c2b66ca..74291bae33 100644 --- a/basis/generalizations/generalizations.factor +++ b/basis/generalizations/generalizations.factor @@ -1,68 +1,73 @@ -! 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 namespaces math -math.ranges combinators macros quotations fry arrays ; -IN: generalizations - -MACRO: nsequence ( n seq -- quot ) - [ - [ drop ] [ '[ _ _ new-sequence ] ] 2bi - [ '[ @ [ _ swap set-nth-unsafe ] keep ] ] reduce - ] keep - '[ @ _ like ] ; - -MACRO: narray ( n -- quot ) - '[ _ { } nsequence ] ; - -MACRO: firstn ( n -- ) - dup zero? [ drop [ drop ] ] [ - [ [ '[ [ _ ] dip nth-unsafe ] ] map ] - [ 1- '[ [ _ ] dip bounds-check 2drop ] ] - bi prefix '[ _ cleave ] - ] if ; - -MACRO: npick ( n -- ) - 1- dup saver [ dup ] rot [ r> swap ] n*quot 3append ; - -MACRO: ndup ( n -- ) - dup '[ _ npick ] n*quot ; - -MACRO: nrot ( n -- ) - 1- dup saver swap [ r> swap ] n*quot append ; - -MACRO: -nrot ( n -- ) - 1- dup [ swap >r ] n*quot swap restorer append ; - -MACRO: ndrop ( n -- ) - [ drop ] n*quot ; - -: nnip ( n -- ) - swap >r ndrop r> ; inline - -MACRO: ntuck ( n -- ) - 2 + [ dupd -nrot ] curry ; - -MACRO: nrev ( n -- quot ) - 1 [a,b] [ ] [ '[ @ _ -nrot ] ] reduce ; - -MACRO: ndip ( quot n -- ) - dup saver -rot restorer 3append ; - -MACRO: nslip ( n -- ) - dup saver [ call ] rot restorer 3append ; - -MACRO: nkeep ( n -- ) - [ ] [ 1+ ] [ ] tri - '[ [ _ ndup ] dip _ -nrot _ nslip ] ; - -MACRO: ncurry ( n -- ) - [ curry ] n*quot ; - -MACRO: nwith ( n -- ) - [ with ] n*quot ; - -MACRO: napply ( n -- ) - 2 [a,b] - [ [ 1- ] keep '[ _ ntuck _ nslip ] ] - map concat >quotation [ call ] append ; +! 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 namespaces math +math.ranges combinators macros quotations fry arrays ; +IN: generalizations + +MACRO: nsequence ( n seq -- quot ) + [ + [ drop ] [ '[ _ _ new-sequence ] ] 2bi + [ '[ @ [ _ swap set-nth-unsafe ] keep ] ] reduce + ] keep + '[ @ _ like ] ; + +MACRO: narray ( n -- quot ) + '[ _ { } nsequence ] ; + +MACRO: firstn ( n -- ) + dup zero? [ drop [ drop ] ] [ + [ [ '[ [ _ ] dip nth-unsafe ] ] map ] + [ 1- '[ [ _ ] dip bounds-check 2drop ] ] + bi prefix '[ _ cleave ] + ] if ; + +: npick-wrap ( quot n -- quot ) + dup 1 > + [ swap '[ _ dip swap ] swap 1 - npick-wrap ] + [ drop ] + if ; + +MACRO: npick ( n -- quot ) [ dup ] swap npick-wrap ; + +MACRO: ndup ( n -- ) + dup '[ _ npick ] n*quot ; + +MACRO: nrot ( n -- ) + 1- dup saver swap [ r> swap ] n*quot append ; + +MACRO: -nrot ( n -- ) + 1- dup [ swap >r ] n*quot swap restorer append ; + +MACRO: ndrop ( n -- ) + [ drop ] n*quot ; + +: nnip ( n -- ) + swap >r ndrop r> ; inline + +MACRO: ntuck ( n -- ) + 2 + [ dupd -nrot ] curry ; + +MACRO: nrev ( n -- quot ) + 1 [a,b] [ ] [ '[ @ _ -nrot ] ] reduce ; + +MACRO: ndip ( quot n -- ) + dup saver -rot restorer 3append ; + +MACRO: nslip ( n -- ) + dup saver [ call ] rot restorer 3append ; + +MACRO: nkeep ( n -- ) + [ ] [ 1+ ] [ ] tri + '[ [ _ ndup ] dip _ -nrot _ nslip ] ; + +MACRO: ncurry ( n -- ) + [ curry ] n*quot ; + +MACRO: nwith ( n -- ) + [ with ] n*quot ; + +MACRO: napply ( n -- ) + 2 [a,b] + [ [ 1- ] keep '[ _ ntuck _ nslip ] ] + map concat >quotation [ call ] append ;