Replace some usages of prepose with fry

db4
Slava Pestov 2009-01-25 23:04:35 -06:00
parent 7360cd5b30
commit 7851aac222
5 changed files with 24 additions and 28 deletions

View File

@ -1,4 +1,4 @@
! Copyright (C) 2004, 2008 Slava Pestov. ! Copyright (C) 2004, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien arrays byte-arrays generic assocs hashtables assocs USING: alien arrays byte-arrays generic assocs hashtables assocs
hashtables.private io io.binary io.files io.encodings.binary hashtables.private io io.binary io.files io.encodings.binary
@ -8,9 +8,9 @@ vectors words quotations assocs system layouts splitting
grouping growable classes classes.builtin classes.tuple grouping growable classes classes.builtin classes.tuple
classes.tuple.private words.private vocabs classes.tuple.private words.private vocabs
vocabs.loader source-files definitions debugger vocabs.loader source-files definitions debugger
quotations.private sequences.private combinators quotations.private sequences.private combinators combinators.smart
math.order math.private accessors math.order math.private accessors
slots.private compiler.units ; slots.private compiler.units fry ;
IN: bootstrap.image IN: bootstrap.image
: arch ( os cpu -- arch ) : arch ( os cpu -- arch )
@ -73,7 +73,7 @@ SYMBOL: objects
: put-object ( n obj -- ) (objects) set-at ; : put-object ( n obj -- ) (objects) set-at ;
: cache-object ( obj quot -- value ) : cache-object ( obj quot -- value )
[ (objects) ] dip [ obj>> ] prepose cache ; inline [ (objects) ] dip '[ obj>> @ ] cache ; inline
! Constants ! Constants
@ -95,7 +95,7 @@ SYMBOL: objects
SYMBOL: sub-primitives SYMBOL: sub-primitives
: make-jit ( quot rc rt offset -- quad ) : make-jit ( quot rc rt offset -- quad )
{ [ { } make ] [ ] [ ] [ ] } spread 4array ; inline [ [ { } make ] 3dip ] output>array ; inline
: jit-define ( quot rc rt offset name -- ) : jit-define ( quot rc rt offset name -- )
[ make-jit ] dip set ; inline [ make-jit ] dip set ; inline
@ -524,11 +524,9 @@ M: quotation '
! Image output ! Image output
: (write-image) ( image -- ) : (write-image) ( image -- )
bootstrap-cell big-endian get [ bootstrap-cell big-endian get
[ >be write ] curry each [ '[ _ >be write ] each ]
] [ [ '[ _ >le write ] each ] if ;
[ >le write ] curry each
] if ;
: write-image ( image -- ) : write-image ( image -- )
"Writing image to " write "Writing image to " write

View File

@ -1,6 +1,6 @@
! Copyright (C) 2008 Slava Pestov. ! Copyright (C) 2008, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: kernel sequences math ; USING: kernel sequences math fry ;
IN: deques IN: deques
GENERIC: push-front* ( obj deque -- node ) GENERIC: push-front* ( obj deque -- node )
@ -34,7 +34,8 @@ GENERIC: deque-empty? ( deque -- ? )
[ peek-back ] [ pop-back* ] bi ; [ peek-back ] [ pop-back* ] bi ;
: slurp-deque ( deque quot -- ) : slurp-deque ( deque quot -- )
[ drop [ deque-empty? not ] curry ] [ drop '[ _ deque-empty? not ] ]
[ [ pop-back ] prepose curry ] 2bi [ ] while ; inline [ '[ _ pop-back @ ] ]
2bi [ ] while ; inline
MIXIN: deque MIXIN: deque

View File

@ -1,8 +1,8 @@
! Copyright (C) 2007, 2008 Mackenzie Straight, Doug Coleman, ! Copyright (C) 2007, 2009 Mackenzie Straight, Doug Coleman,
! Slava Pestov. ! Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: combinators kernel math sequences accessors deques USING: combinators kernel math sequences accessors deques
search-deques summary hashtables ; search-deques summary hashtables fry ;
IN: dlists IN: dlists
<PRIVATE <PRIVATE
@ -64,7 +64,7 @@ M: dlist-node node-value obj>> ;
[ front>> ] dip (dlist-find-node) ; inline [ front>> ] dip (dlist-find-node) ; inline
: dlist-each-node ( dlist quot -- ) : dlist-each-node ( dlist quot -- )
[ f ] compose dlist-find-node 2drop ; inline '[ @ f ] dlist-find-node 2drop ; inline
: unlink-node ( dlist-node -- ) : unlink-node ( dlist-node -- )
dup prev>> over next>> set-prev-when dup prev>> over next>> set-prev-when
@ -115,8 +115,7 @@ M: dlist pop-back* ( dlist -- )
normalize-front ; normalize-front ;
: dlist-find ( dlist quot -- obj/f ? ) : dlist-find ( dlist quot -- obj/f ? )
[ obj>> ] prepose '[ obj>> @ ] dlist-find-node [ obj>> t ] [ drop f f ] if ; inline
dlist-find-node [ obj>> t ] [ drop f f ] if ; inline
: dlist-contains? ( dlist quot -- ? ) : dlist-contains? ( dlist quot -- ? )
dlist-find nip ; inline dlist-find nip ; inline
@ -143,7 +142,7 @@ M: dlist delete-node ( dlist-node dlist -- )
] if ; inline ] if ; inline
: delete-node-if ( dlist quot -- obj/f ) : delete-node-if ( dlist quot -- obj/f )
[ obj>> ] prepose delete-node-if* drop ; inline '[ obj>> @ ] delete-node-if* drop ; inline
M: dlist clear-deque ( dlist -- ) M: dlist clear-deque ( dlist -- )
f >>front f >>front
@ -151,7 +150,7 @@ M: dlist clear-deque ( dlist -- )
drop ; drop ;
: dlist-each ( dlist quot -- ) : dlist-each ( dlist quot -- )
[ obj>> ] prepose dlist-each-node ; inline '[ obj>> @ ] dlist-each-node ; inline
: dlist>seq ( dlist -- seq ) : dlist>seq ( dlist -- seq )
[ ] accumulator [ dlist-each ] dip ; [ ] accumulator [ dlist-each ] dip ;
@ -159,8 +158,6 @@ M: dlist clear-deque ( dlist -- )
: 1dlist ( obj -- dlist ) <dlist> [ push-front ] keep ; : 1dlist ( obj -- dlist ) <dlist> [ push-front ] keep ;
M: dlist clone M: dlist clone
<dlist> [ <dlist> [ '[ _ push-back ] dlist-each ] keep ;
[ push-back ] curry dlist-each
] keep ;
INSTANCE: dlist deque INSTANCE: dlist deque

View File

@ -1,7 +1,7 @@
! Copyright (C) 2005, 2009 Slava Pestov. ! Copyright (C) 2005, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: kernel math math.order strings arrays vectors sequences USING: kernel math math.order strings arrays vectors sequences
sequences.private accessors ; sequences.private accessors fry ;
IN: grouping IN: grouping
<PRIVATE <PRIVATE
@ -94,7 +94,7 @@ INSTANCE: sliced-clumps slice-chunking
[ first2-unsafe ] dip call [ first2-unsafe ] dip call
] [ ] [
[ 2 <sliced-clumps> ] dip [ 2 <sliced-clumps> ] dip
[ first2-unsafe ] prepose all? '[ first2-unsafe @ ] all?
] if ] if
] if ; inline ] if ; inline

View File

@ -1,6 +1,6 @@
USING: kernel alien.c-types alien.strings sequences math alien.syntax unix USING: kernel alien.c-types alien.strings sequences math alien.syntax unix
vectors kernel namespaces continuations threads assocs vectors vectors kernel namespaces continuations threads assocs vectors
io.backend.unix io.encodings.utf8 unix.utilities ; io.backend.unix io.encodings.utf8 unix.utilities fry ;
IN: unix.process IN: unix.process
! Low-level Unix process launching utilities. These are used ! Low-level Unix process launching utilities. These are used
@ -36,7 +36,7 @@ FUNCTION: int execve ( char* path, char** argv, char** envp ) ;
[ [ first ] [ ] bi ] dip exec-with-env ; [ [ first ] [ ] bi ] dip exec-with-env ;
: with-fork ( child parent -- ) : with-fork ( child parent -- )
[ [ fork-process dup zero? ] dip [ drop ] prepose ] dip [ [ fork-process dup zero? ] dip '[ drop @ ] ] dip
if ; inline if ; inline
CONSTANT: SIGKILL 9 CONSTANT: SIGKILL 9