From 6923b32ebfcc26f06c2cd60d89311078eb4365c5 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Tue, 24 Jun 2008 08:35:06 -0500 Subject: [PATCH 1/9] Add combinators.short-circuit --- .../short-circuit/short-circuit.factor | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 extra/combinators/short-circuit/short-circuit.factor diff --git a/extra/combinators/short-circuit/short-circuit.factor b/extra/combinators/short-circuit/short-circuit.factor new file mode 100644 index 0000000000..cda8ea4706 --- /dev/null +++ b/extra/combinators/short-circuit/short-circuit.factor @@ -0,0 +1,43 @@ + +USING: kernel combinators quotations arrays sequences assocs macros fry ; + +IN: combinators.short-circuit + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: short-circuit ( quots quot default -- quot ) + 1quotation -rot { } map>assoc alist>quot ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +MACRO: 0&& ( quots -- quot ) + [ '[ drop @ dup not ] [ drop f ] 2array ] map + { [ t ] [ ] } suffix + '[ f , cond ] ; + +MACRO: 1&& ( quots -- quot ) + [ '[ drop dup @ dup not ] [ drop drop f ] 2array ] map + { [ t ] [ nip ] } suffix + '[ f , cond ] ; + +MACRO: 2&& ( quots -- quot ) + [ '[ drop 2dup @ dup not ] [ drop 2drop f ] 2array ] map + { [ t ] [ 2nip ] } suffix + '[ f , cond ] ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +MACRO: 0|| ( quots -- quot ) + [ '[ drop @ dup ] [ ] 2array ] map + { [ drop t ] [ f ] } suffix + '[ f , cond ] ; + +MACRO: 1|| ( quots -- quot ) + [ '[ drop dup @ dup ] [ nip ] 2array ] map + { [ drop drop t ] [ f ] } suffix + '[ f , cond ] ; + +MACRO: 2|| ( quots -- quot ) + [ '[ drop 2dup @ dup ] [ 2nip ] 2array ] map + { [ drop 2drop t ] [ f ] } suffix + '[ f , cond ] ; From e88b83b32f33a5831f29478b98f5c45470a1d9ac Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Tue, 24 Jun 2008 08:35:36 -0500 Subject: [PATCH 2/9] Update vocabs for combinators.short-circuit --- extra/combinators/lib/lib.factor | 52 ++++++++++++------------ extra/http/parsers/parsers.factor | 2 +- extra/unicode/breaks/breaks.factor | 2 +- extra/unicode/collation/collation.factor | 2 +- extra/unicode/data/data.factor | 2 +- 5 files changed, 30 insertions(+), 30 deletions(-) diff --git a/extra/combinators/lib/lib.factor b/extra/combinators/lib/lib.factor index fe6b68638b..d9509b30f4 100755 --- a/extra/combinators/lib/lib.factor +++ b/extra/combinators/lib/lib.factor @@ -63,42 +63,42 @@ MACRO: napply ( n -- ) ! short circuiting words ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -: short-circuit ( quots quot default -- quot ) - 1quotation -rot { } map>assoc alist>quot ; +! : short-circuit ( quots quot default -- quot ) +! 1quotation -rot { } map>assoc alist>quot ; ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -MACRO: 0&& ( quots -- quot ) - [ '[ drop @ dup not ] [ drop f ] 2array ] map - { [ t ] [ ] } suffix - '[ f , cond ] ; +! MACRO: 0&& ( quots -- quot ) +! [ '[ drop @ dup not ] [ drop f ] 2array ] map +! { [ t ] [ ] } suffix +! '[ f , cond ] ; -MACRO: 1&& ( quots -- quot ) - [ '[ drop dup @ dup not ] [ drop drop f ] 2array ] map - { [ t ] [ nip ] } suffix - '[ f , cond ] ; +! MACRO: 1&& ( quots -- quot ) +! [ '[ drop dup @ dup not ] [ drop drop f ] 2array ] map +! { [ t ] [ nip ] } suffix +! '[ f , cond ] ; -MACRO: 2&& ( quots -- quot ) - [ '[ drop 2dup @ dup not ] [ drop 2drop f ] 2array ] map - { [ t ] [ 2nip ] } suffix - '[ f , cond ] ; +! MACRO: 2&& ( quots -- quot ) +! [ '[ drop 2dup @ dup not ] [ drop 2drop f ] 2array ] map +! { [ t ] [ 2nip ] } suffix +! '[ f , cond ] ; ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -MACRO: 0|| ( quots -- quot ) - [ '[ drop @ dup ] [ ] 2array ] map - { [ drop t ] [ f ] } suffix - '[ f , cond ] ; +! MACRO: 0|| ( quots -- quot ) +! [ '[ drop @ dup ] [ ] 2array ] map +! { [ drop t ] [ f ] } suffix +! '[ f , cond ] ; -MACRO: 1|| ( quots -- quot ) - [ '[ drop dup @ dup ] [ nip ] 2array ] map - { [ drop drop t ] [ f ] } suffix - '[ f , cond ] ; +! MACRO: 1|| ( quots -- quot ) +! [ '[ drop dup @ dup ] [ nip ] 2array ] map +! { [ drop drop t ] [ f ] } suffix +! '[ f , cond ] ; -MACRO: 2|| ( quots -- quot ) - [ '[ drop 2dup @ dup ] [ 2nip ] 2array ] map - { [ drop 2drop t ] [ f ] } suffix - '[ f , cond ] ; +! MACRO: 2|| ( quots -- quot ) +! [ '[ drop 2dup @ dup ] [ 2nip ] 2array ] map +! { [ drop 2drop t ] [ f ] } suffix +! '[ f , cond ] ; ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! ifte diff --git a/extra/http/parsers/parsers.factor b/extra/http/parsers/parsers.factor index 33bfa4b202..bc6e1148c3 100644 --- a/extra/http/parsers/parsers.factor +++ b/extra/http/parsers/parsers.factor @@ -1,4 +1,4 @@ -USING: math math.order math.parser kernel combinators.lib +USING: combinators.short-circuit math math.order math.parser kernel combinators.lib sequences sequences.deep peg peg.parsers assocs arrays hashtables strings unicode.case namespaces ascii ; IN: http.parsers diff --git a/extra/unicode/breaks/breaks.factor b/extra/unicode/breaks/breaks.factor index b70d79b872..745fb83c3c 100755 --- a/extra/unicode/breaks/breaks.factor +++ b/extra/unicode/breaks/breaks.factor @@ -1,4 +1,4 @@ -USING: unicode.categories kernel math combinators splitting +USING: combinators.short-circuit unicode.categories kernel math combinators splitting sequences math.parser io.files io assocs arrays namespaces math.ranges unicode.normalize values io.encodings.ascii unicode.syntax unicode.data compiler.units alien.syntax sets diff --git a/extra/unicode/collation/collation.factor b/extra/unicode/collation/collation.factor index 216f80c79d..8deed708e6 100755 --- a/extra/unicode/collation/collation.factor +++ b/extra/unicode/collation/collation.factor @@ -1,4 +1,4 @@ -USING: sequences io.files io.encodings.ascii kernel values +USING: combinators.short-circuit sequences io.files io.encodings.ascii kernel values splitting accessors math.parser ascii io assocs strings math namespaces sorting combinators math.order arrays unicode.normalize unicode.data combinators.lib locals diff --git a/extra/unicode/data/data.factor b/extra/unicode/data/data.factor index 5fb769e499..b6c6292e90 100755 --- a/extra/unicode/data/data.factor +++ b/extra/unicode/data/data.factor @@ -1,4 +1,4 @@ -USING: assocs math kernel sequences io.files hashtables +USING: combinators.short-circuit assocs math kernel sequences io.files hashtables quotations splitting grouping arrays math.parser hash2 math.order byte-arrays words namespaces words compiler.units parser io.encodings.ascii values interval-maps ascii sets From 8cd16e5bf8c65f0f0437c7e2ba2a9bf2bf9eee6b Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Tue, 24 Jun 2008 10:39:50 -0500 Subject: [PATCH 3/9] combinators.short-circuit: n&&-rewrite and n||-rewrite --- .../short-circuit/short-circuit.factor | 47 +++++++++---------- 1 file changed, 21 insertions(+), 26 deletions(-) diff --git a/extra/combinators/short-circuit/short-circuit.factor b/extra/combinators/short-circuit/short-circuit.factor index cda8ea4706..1738e8ec38 100644 --- a/extra/combinators/short-circuit/short-circuit.factor +++ b/extra/combinators/short-circuit/short-circuit.factor @@ -1,5 +1,6 @@ -USING: kernel combinators quotations arrays sequences assocs macros fry ; +USING: kernel combinators quotations arrays sequences assocs + locals shuffle macros fry newfx ; IN: combinators.short-circuit @@ -10,34 +11,28 @@ IN: combinators.short-circuit ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -MACRO: 0&& ( quots -- quot ) - [ '[ drop @ dup not ] [ drop f ] 2array ] map - { [ t ] [ ] } suffix - '[ f , cond ] ; +:: n&&-rewrite ( quots N -- quot ) + quots + [ '[ drop N ndup @ dup not ] [ drop N ndrop f ] 2array ] + map + [ t ] [ N nnip ] 2array suffix + '[ f , cond ] ; -MACRO: 1&& ( quots -- quot ) - [ '[ drop dup @ dup not ] [ drop drop f ] 2array ] map - { [ t ] [ nip ] } suffix - '[ f , cond ] ; - -MACRO: 2&& ( quots -- quot ) - [ '[ drop 2dup @ dup not ] [ drop 2drop f ] 2array ] map - { [ t ] [ 2nip ] } suffix - '[ f , cond ] ; +MACRO: 0&& ( quots -- quot ) 0 n&&-rewrite ; +MACRO: 1&& ( quots -- quot ) 1 n&&-rewrite ; +MACRO: 2&& ( quots -- quot ) 2 n&&-rewrite ; ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -MACRO: 0|| ( quots -- quot ) - [ '[ drop @ dup ] [ ] 2array ] map - { [ drop t ] [ f ] } suffix - '[ f , cond ] ; +:: n||-rewrite ( quots N -- quot ) + quots + [ '[ drop N ndup @ dup ] [ N nnip ] 2array ] + map + [ drop N ndrop t ] [ f ] 2array suffix + '[ f , cond ] ; -MACRO: 1|| ( quots -- quot ) - [ '[ drop dup @ dup ] [ nip ] 2array ] map - { [ drop drop t ] [ f ] } suffix - '[ f , cond ] ; +MACRO: 0|| ( quots -- quot ) 0 n||-rewrite ; +MACRO: 1|| ( quots -- quot ) 1 n||-rewrite ; +MACRO: 2|| ( quots -- quot ) 2 n||-rewrite ; -MACRO: 2|| ( quots -- quot ) - [ '[ drop 2dup @ dup ] [ 2nip ] 2array ] map - { [ drop 2drop t ] [ f ] } suffix - '[ f , cond ] ; +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! From e1b9e3485ae0f8524849902f5eed3473ca7a8183 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Tue, 24 Jun 2008 10:40:27 -0500 Subject: [PATCH 4/9] combinators.short-circuit: tests --- .../short-circuit/short-circuit-tests.factor | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 extra/combinators/short-circuit/short-circuit-tests.factor diff --git a/extra/combinators/short-circuit/short-circuit-tests.factor b/extra/combinators/short-circuit/short-circuit-tests.factor new file mode 100644 index 0000000000..e392d67d2a --- /dev/null +++ b/extra/combinators/short-circuit/short-circuit-tests.factor @@ -0,0 +1,32 @@ + +USING: kernel math tools.test combinators.short-circuit ; + +IN: combinators.short-circuit.tests + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: must-be-t ( in -- ) [ t ] swap unit-test ; +: must-be-f ( in -- ) [ f ] swap unit-test ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +[ { [ 1 ] [ 2 ] [ 3 ] } 0&& 3 = ] must-be-t +[ 3 { [ 0 > ] [ odd? ] [ 2 + ] } 1&& 5 = ] must-be-t +[ 10 20 { [ + 0 > ] [ - even? ] [ + ] } 2&& 30 = ] must-be-t + +[ { [ 1 ] [ f ] [ 3 ] } 0&& 3 = ] must-be-f +[ 3 { [ 0 > ] [ even? ] [ 2 + ] } 1&& ] must-be-f +[ 10 20 { [ + 0 > ] [ - odd? ] [ + ] } 2&& 30 = ] must-be-f + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +[ { [ 10 0 < ] [ f ] [ "factor" ] } 0|| "factor" = ] must-be-t + +[ 10 { [ odd? ] [ 100 > ] [ 1 + ] } 1|| 11 = ] must-be-t + +[ 10 20 { [ + odd? ] [ + 100 > ] [ + ] } 2|| 30 = ] must-be-t + +[ { [ 10 0 < ] [ f ] [ 0 1 = ] } 0|| ] must-be-f + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + From 945fe1bc748cc0f136557cad63f43ef7bc074b5c Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Tue, 24 Jun 2008 10:40:55 -0500 Subject: [PATCH 5/9] Add combinators.short-circuit.smart --- .../short-circuit/smart/smart-tests.factor | 32 +++++++++++++++++++ .../short-circuit/smart/smart.factor | 11 +++++++ 2 files changed, 43 insertions(+) create mode 100644 extra/combinators/short-circuit/smart/smart-tests.factor create mode 100644 extra/combinators/short-circuit/smart/smart.factor diff --git a/extra/combinators/short-circuit/smart/smart-tests.factor b/extra/combinators/short-circuit/smart/smart-tests.factor new file mode 100644 index 0000000000..7ec4a0e657 --- /dev/null +++ b/extra/combinators/short-circuit/smart/smart-tests.factor @@ -0,0 +1,32 @@ + +USING: kernel math tools.test combinators.short-circuit.smart ; + +IN: combinators.short-circuit.smart.tests + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: must-be-t ( in -- ) [ t ] swap unit-test ; +: must-be-f ( in -- ) [ f ] swap unit-test ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +[ { [ 1 ] [ 2 ] [ 3 ] } && 3 = ] must-be-t +[ 3 { [ 0 > ] [ odd? ] [ 2 + ] } && 5 = ] must-be-t +[ 10 20 { [ + 0 > ] [ - even? ] [ + ] } && 30 = ] must-be-t + +[ { [ 1 ] [ f ] [ 3 ] } && 3 = ] must-be-f +[ 3 { [ 0 > ] [ even? ] [ 2 + ] } && ] must-be-f +[ 10 20 { [ + 0 > ] [ - odd? ] [ + ] } && 30 = ] must-be-f + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +[ { [ 10 0 < ] [ f ] [ "factor" ] } || "factor" = ] must-be-t + +[ 10 { [ odd? ] [ 100 > ] [ 1 + ] } || 11 = ] must-be-t + +[ 10 20 { [ + odd? ] [ + 100 > ] [ + ] } || 30 = ] must-be-t + +[ { [ 10 0 < ] [ f ] [ 0 1 = ] } || ] must-be-f + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + diff --git a/extra/combinators/short-circuit/smart/smart.factor b/extra/combinators/short-circuit/smart/smart.factor new file mode 100644 index 0000000000..2cef957a6f --- /dev/null +++ b/extra/combinators/short-circuit/smart/smart.factor @@ -0,0 +1,11 @@ + +USING: kernel sequences math inference accessors macros + combinators.short-circuit ; + +IN: combinators.short-circuit.smart + +MACRO: && ( quots -- quot ) + dup first infer [ in>> ] [ out>> ] bi - 1+ n&&-rewrite ; + +MACRO: || ( quots -- quot ) + dup first infer [ in>> ] [ out>> ] bi - 1+ n||-rewrite ; From bf238283daf7b2bee71e554100565e7fa90a6506 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Tue, 24 Jun 2008 13:47:54 -0500 Subject: [PATCH 6/9] Update code for combinators.short-circuit --- extra/boids/boids.factor | 2 +- extra/boids/ui/ui.factor | 2 +- extra/dns/forwarding/forwarding.factor | 2 +- extra/dns/server/server.factor | 2 +- extra/ftp/server/server.factor | 2 +- extra/inverse/inverse.factor | 2 +- extra/io/servers/connection/connection.factor | 2 +- extra/lcs/lcs.factor | 3 ++- extra/lisp/lisp.factor | 2 +- extra/lisp/parser/parser.factor | 2 +- extra/lsys/strings/interpret/interpret.factor | 2 +- extra/lsys/strings/rewrite/rewrite.factor | 2 +- extra/lsys/strings/strings.factor | 2 +- extra/lsys/tortoise/graphics/graphics.factor | 2 +- extra/lsys/ui/ui.factor | 3 ++- extra/math/text/english/english.factor | 3 ++- extra/peg/ebnf/ebnf.factor | 3 ++- extra/project-euler/014/014.factor | 2 +- extra/project-euler/017/017.factor | 2 +- extra/project-euler/021/021.factor | 3 ++- extra/project-euler/036/036.factor | 2 +- extra/project-euler/043/043.factor | 3 ++- extra/project-euler/052/052.factor | 3 ++- extra/project-euler/project-euler.factor | 2 +- extra/regexp/regexp.factor | 3 ++- extra/shell/shell.factor | 3 ++- extra/xmode/marker/marker.factor | 3 ++- 27 files changed, 37 insertions(+), 27 deletions(-) diff --git a/extra/boids/boids.factor b/extra/boids/boids.factor index 4151b44cfb..e6c97b90dd 100644 --- a/extra/boids/boids.factor +++ b/extra/boids/boids.factor @@ -1,5 +1,5 @@ -USING: kernel namespaces +USING: combinators.short-circuit kernel namespaces math math.constants math.functions diff --git a/extra/boids/ui/ui.factor b/extra/boids/ui/ui.factor index a1feac381d..3b28e79bcf 100755 --- a/extra/boids/ui/ui.factor +++ b/extra/boids/ui/ui.factor @@ -1,5 +1,5 @@ -USING: kernel namespaces +USING: combinators.short-circuit kernel namespaces math math.functions math.vectors diff --git a/extra/dns/forwarding/forwarding.factor b/extra/dns/forwarding/forwarding.factor index 039b969ddd..87f9821153 100644 --- a/extra/dns/forwarding/forwarding.factor +++ b/extra/dns/forwarding/forwarding.factor @@ -1,5 +1,5 @@ -USING: kernel +USING: combinators.short-circuit kernel combinators vectors sequences diff --git a/extra/dns/server/server.factor b/extra/dns/server/server.factor index 04b3ecfbee..16677d8761 100644 --- a/extra/dns/server/server.factor +++ b/extra/dns/server/server.factor @@ -1,7 +1,7 @@ USING: kernel combinators sequences sets math threads namespaces continuations debugger io io.sockets unicode.case accessors destructors - combinators.cleave combinators.lib + combinators.cleave combinators.lib combinators.short-circuit newfx fry dns dns.util dns.misc ; diff --git a/extra/ftp/server/server.factor b/extra/ftp/server/server.factor index c71eadb72f..c5a5449b25 100644 --- a/extra/ftp/server/server.factor +++ b/extra/ftp/server/server.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2008 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors combinators io io.encodings.8-bit +USING: combinators.short-circuit accessors combinators io io.encodings.8-bit io.encodings io.encodings.binary io.encodings.utf8 io.files io.sockets kernel math.parser namespaces sequences ftp io.unix.launcher.parser unicode.case splitting assocs diff --git a/extra/inverse/inverse.factor b/extra/inverse/inverse.factor index ef1f575972..43507046d6 100755 --- a/extra/inverse/inverse.factor +++ b/extra/inverse/inverse.factor @@ -2,7 +2,7 @@ USING: kernel words inspector slots quotations sequences assocs math arrays inference effects shuffle continuations debugger classes.tuple namespaces vectors bit-arrays byte-arrays strings sbufs math.functions macros sequences.private combinators -mirrors combinators.lib ; +mirrors combinators.lib combinators.short-circuit ; IN: inverse TUPLE: fail ; diff --git a/extra/io/servers/connection/connection.factor b/extra/io/servers/connection/connection.factor index b062322142..0ff83261fb 100755 --- a/extra/io/servers/connection/connection.factor +++ b/extra/io/servers/connection/connection.factor @@ -6,7 +6,7 @@ quotations combinators combinators.lib logging calendar assocs fry accessors arrays io io.sockets io.encodings.ascii io.sockets.secure io.files io.streams.duplex io.timeouts io.encodings threads concurrency.combinators -concurrency.semaphores ; +concurrency.semaphores combinators.short-circuit ; IN: io.servers.connection TUPLE: threaded-server diff --git a/extra/lcs/lcs.factor b/extra/lcs/lcs.factor index 4b0fb53f5e..2fa0b6cc71 100755 --- a/extra/lcs/lcs.factor +++ b/extra/lcs/lcs.factor @@ -1,5 +1,6 @@ USING: sequences kernel math locals math.order math.ranges -accessors combinators.lib arrays namespaces combinators ; +accessors combinators.lib arrays namespaces combinators +combinators.short-circuit ; IN: lcs Date: Tue, 24 Jun 2008 18:07:41 -0500 Subject: [PATCH 7/9] combinators.lib tests: minor update --- extra/combinators/lib/lib-tests.factor | 29 -------------------------- 1 file changed, 29 deletions(-) diff --git a/extra/combinators/lib/lib-tests.factor b/extra/combinators/lib/lib-tests.factor index 78916bb027..680e3220b0 100755 --- a/extra/combinators/lib/lib-tests.factor +++ b/extra/combinators/lib/lib-tests.factor @@ -23,35 +23,6 @@ IN: combinators.lib.tests { "oof" "bar" } { [ reverse ] [ "x" swap "x" 3append ] } parallel-call ] unit-test -! && - -[ t ] [ - 3 { - [ dup number? ] [ dup odd? ] [ dup 0 > ] - } 0&& nip -] unit-test - -[ f ] [ - 3 { - [ dup number? ] [ dup even? ] [ dup 0 > ] - } 0&& nip -] unit-test - -! || - -[ t ] [ - 4 { - [ dup array? ] [ dup number? ] [ 3 throw ] - } 0|| nip -] unit-test - -[ f ] [ - 4 { - [ dup array? ] [ dup vector? ] [ dup float? ] - } 0|| nip -] unit-test - - { 1 1 } [ [ even? ] [ drop 1 ] [ drop 2 ] ifte ] must-infer-as From ec3c47d9572328a0fa689831ef461083c91332a3 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Tue, 24 Jun 2008 18:10:17 -0500 Subject: [PATCH 8/9] furnace.sessions: uses 0|| --- extra/furnace/sessions/sessions.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/furnace/sessions/sessions.factor b/extra/furnace/sessions/sessions.factor index 6e50417ea1..0ec9648a67 100755 --- a/extra/furnace/sessions/sessions.factor +++ b/extra/furnace/sessions/sessions.factor @@ -7,7 +7,7 @@ io.servers.connection db db.tuples db.types http http.server http.server.dispatchers http.server.filters html.elements -furnace furnace.cache ; +furnace furnace.cache combinators.short-circuit ; IN: furnace.sessions TUPLE: session < server-state namespace user-agent client changed? ; From 74f2627526a5abc928c7a8e51da8c9337b270254 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Tue, 24 Jun 2008 18:33:08 -0500 Subject: [PATCH 9/9] More short-circuit updates --- extra/furnace/auth/login/permits/permits.factor | 4 +++- extra/furnace/boilerplate/boilerplate.factor | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/extra/furnace/auth/login/permits/permits.factor b/extra/furnace/auth/login/permits/permits.factor index 49cf98e0e3..ae9458f4ac 100644 --- a/extra/furnace/auth/login/permits/permits.factor +++ b/extra/furnace/auth/login/permits/permits.factor @@ -1,6 +1,8 @@ USING: accessors namespaces combinators.lib kernel db.tuples db.types -furnace.auth furnace.sessions furnace.cache ; +furnace.auth furnace.sessions furnace.cache +combinators.short-circuit ; + IN: furnace.auth.login.permits TUPLE: permit < server-state session uid ; diff --git a/extra/furnace/boilerplate/boilerplate.factor b/extra/furnace/boilerplate/boilerplate.factor index 0e2a673d9b..2bb97e7c14 100644 --- a/extra/furnace/boilerplate/boilerplate.factor +++ b/extra/furnace/boilerplate/boilerplate.factor @@ -7,7 +7,7 @@ html.templates.chloe locals http.server http.server.filters -furnace ; +furnace combinators.short-circuit ; IN: furnace.boilerplate TUPLE: boilerplate < filter-responder template init ;