Code cleanup

db4
Slava Pestov 2008-06-25 03:33:58 -05:00
parent 726bcb6a0b
commit b26e6b90f5
12 changed files with 25 additions and 34 deletions

View File

@ -1,16 +1,11 @@
USING: kernel combinators quotations arrays sequences assocs USING: kernel combinators quotations arrays sequences assocs
locals shuffle macros fry newfx ; locals shuffle macros fry ;
IN: combinators.short-circuit IN: combinators.short-circuit
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: short-circuit ( quots quot default -- quot )
1quotation -rot { } map>assoc <reversed> alist>quot ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
:: n&&-rewrite ( quots N -- quot ) :: n&&-rewrite ( quots N -- quot )
quots quots
[ '[ drop N ndup @ dup not ] [ drop N ndrop f ] 2array ] [ '[ drop N ndup @ dup not ] [ drop N ndrop f ] 2array ]

View File

@ -2,7 +2,7 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: continuations destructors kernel math math.parser USING: continuations destructors kernel math math.parser
namespaces parser sequences strings prettyprint debugger namespaces parser sequences strings prettyprint debugger
quotations combinators combinators.lib logging calendar assocs quotations combinators logging calendar assocs
fry accessors arrays io io.sockets io.encodings.ascii fry accessors arrays io io.sockets io.encodings.ascii
io.sockets.secure io.files io.streams.duplex io.timeouts io.sockets.secure io.files io.streams.duplex io.timeouts
io.encodings threads concurrency.combinators io.encodings threads concurrency.combinators

View File

@ -1,4 +1,4 @@
USING: arrays combinators.lib kernel math math.functions USING: arrays kernel math math.functions
math.order math.vectors namespaces opengl opengl.gl sequences ui math.order math.vectors namespaces opengl opengl.gl sequences ui
ui.gadgets ui.gestures ui.render accessors ; ui.gadgets ui.gestures ui.render accessors ;
IN: opengl.demo-support IN: opengl.demo-support

View File

@ -2,7 +2,7 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: kernel opengl.gl alien.c-types continuations namespaces USING: kernel opengl.gl alien.c-types continuations namespaces
assocs alien alien.strings libc opengl math sequences combinators assocs alien alien.strings libc opengl math sequences combinators
combinators.lib macros arrays io.encodings.ascii ; macros arrays io.encodings.ascii ;
IN: opengl.shaders IN: opengl.shaders
: with-gl-shader-source-ptr ( string quot -- ) : with-gl-shader-source-ptr ( string quot -- )

View File

@ -21,9 +21,6 @@ SYMBOL: ignore-case?
[ [ between? ] ] [ [ between? ] ]
if 2curry ; if 2curry ;
: or-predicates ( quots -- quot )
[ \ dup prefix ] map [ [ t ] ] f short-circuit \ nip suffix ;
: <@literal ( parser obj -- action ) [ nip ] curry <@ ; : <@literal ( parser obj -- action ) [ nip ] curry <@ ;
: <@delay ( parser quot -- action ) [ curry ] curry <@ ; : <@delay ( parser quot -- action ) [ curry ] curry <@ ;
@ -180,7 +177,7 @@ C: <group-result> group-result
: 'positive-character-class' ( -- parser ) : 'positive-character-class' ( -- parser )
"]" token [ CHAR: ] = ] <@literal 'character-class-term' <*> <&:> "]" token [ CHAR: ] = ] <@literal 'character-class-term' <*> <&:>
'character-class-term' <+> <|> 'character-class-term' <+> <|>
[ or-predicates ] <@ ; [ [ 1|| ] curry ] <@ ;
: 'negative-character-class' ( -- parser ) : 'negative-character-class' ( -- parser )
"^" token 'positive-character-class' &> "^" token 'positive-character-class' &>

View File

@ -1,8 +1,7 @@
USING: combinators.short-circuit 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 sequences math.parser io.files io assocs arrays namespaces
math.ranges unicode.normalize values io.encodings.ascii math.ranges unicode.normalize values io.encodings.ascii
unicode.syntax unicode.data compiler.units alien.syntax sets unicode.syntax unicode.data compiler.units alien.syntax sets ;
combinators.lib ;
IN: unicode.breaks IN: unicode.breaks
C-ENUM: Any L V T Extend Control CR LF graphemes ; C-ENUM: Any L V T Extend Control CR LF graphemes ;

View File

@ -1,6 +1,6 @@
USING: io io.files splitting grouping unicode.collation USING: io io.files splitting grouping unicode.collation
sequences kernel io.encodings.utf8 math.parser math.order sequences kernel io.encodings.utf8 math.parser math.order
tools.test assocs io.streams.null words combinators.lib ; tools.test assocs io.streams.null words ;
IN: unicode.collation.tests IN: unicode.collation.tests
: parse-test ( -- strings ) : parse-test ( -- strings )

View File

@ -1,7 +1,7 @@
USING: combinators.short-circuit sequences io.files io.encodings.ascii kernel values USING: combinators.short-circuit sequences io.files
splitting accessors math.parser ascii io assocs strings math io.encodings.ascii kernel values splitting accessors math.parser
namespaces sorting combinators math.order arrays ascii io assocs strings math namespaces sorting combinators
unicode.normalize unicode.data combinators.lib locals math.order arrays unicode.normalize unicode.data locals
unicode.syntax macros sequences.deep words unicode.breaks unicode.syntax macros sequences.deep words unicode.breaks
quotations ; quotations ;
IN: unicode.collation IN: unicode.collation
@ -86,7 +86,7 @@ ducet insert-helpers
: add ( char -- ) : add ( char -- )
dup blocked? [ 1string , ] [ dup blocked? [ 1string , ] [
dup possible-bases dup length dup possible-bases dup length
[ ?combine ] 2with contains? [ ?combine ] with with contains?
[ drop ] [ 1string , ] if [ drop ] [ 1string , ] if
] if ; ] if ;

View File

@ -1,8 +1,8 @@
USING: combinators.short-circuit assocs math kernel sequences io.files hashtables USING: combinators.short-circuit assocs math kernel sequences
quotations splitting grouping arrays math.parser hash2 math.order io.files hashtables quotations splitting grouping arrays
byte-arrays words namespaces words compiler.units parser math.parser hash2 math.order byte-arrays words namespaces words
io.encodings.ascii values interval-maps ascii sets compiler.units parser io.encodings.ascii values interval-maps
combinators.lib combinators locals math.ranges sorting ; ascii sets combinators locals math.ranges sorting ;
IN: unicode.data IN: unicode.data
VALUE: simple-lower VALUE: simple-lower

View File

@ -1,5 +1,5 @@
USING: sequences namespaces unicode.data kernel math arrays USING: sequences namespaces unicode.data kernel math arrays
locals combinators.lib sorting.insertion combinators.lib ; locals sorting.insertion ;
IN: unicode.normalize IN: unicode.normalize
! Conjoining Jamo behavior ! Conjoining Jamo behavior

View File

@ -1,11 +1,11 @@
! Copyright (C) 2008 Slava Pestov. ! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: kernel unicode.categories combinators combinators.lib USING: kernel unicode.categories combinators
sequences splitting combinators.short-circuit sequences splitting fry namespaces
fry namespaces assocs arrays strings io.sockets assocs arrays strings io.sockets io.sockets.secure
io.sockets.secure io.encodings.string io.encodings.utf8 io.encodings.string io.encodings.utf8 math math.parser accessors
math math.parser accessors mirrors parser strings.parser lexer mirrors parser strings.parser lexer prettyprint.backend
prettyprint.backend hashtables present ; hashtables present ;
IN: urls IN: urls
: url-quotable? ( ch -- ? ) : url-quotable? ( ch -- ? )

View File

@ -1,7 +1,7 @@
! Copyright (C) 2007 Doug Coleman. ! Copyright (C) 2007 Doug Coleman.
! Copyright (C) 2008 Slava Pestov. ! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: math.ranges sequences random accessors combinators.lib USING: math.ranges sequences random accessors
kernel namespaces fry db.types db.tuples urls validators kernel namespaces fry db.types db.tuples urls validators
html.components html.forms http http.server.dispatchers furnace html.components html.forms http http.server.dispatchers furnace
furnace.actions furnace.boilerplate furnace.redirection ; furnace.actions furnace.boilerplate furnace.redirection ;