From 7851aac222b2513c90e85b3c7f866b9fe331b554 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sun, 25 Jan 2009 23:04:35 -0600 Subject: [PATCH] Replace some usages of prepose with fry --- basis/bootstrap/image/image.factor | 18 ++++++++---------- basis/deques/deques.factor | 9 +++++---- basis/dlists/dlists.factor | 17 +++++++---------- basis/grouping/grouping.factor | 4 ++-- basis/unix/process/process.factor | 4 ++-- 5 files changed, 24 insertions(+), 28 deletions(-) diff --git a/basis/bootstrap/image/image.factor b/basis/bootstrap/image/image.factor index 3e3c4a93aa..08c75fec34 100644 --- a/basis/bootstrap/image/image.factor +++ b/basis/bootstrap/image/image.factor @@ -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. USING: alien arrays byte-arrays generic assocs hashtables assocs 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 classes.tuple.private words.private vocabs vocabs.loader source-files definitions debugger -quotations.private sequences.private combinators +quotations.private sequences.private combinators combinators.smart math.order math.private accessors -slots.private compiler.units ; +slots.private compiler.units fry ; IN: bootstrap.image : arch ( os cpu -- arch ) @@ -73,7 +73,7 @@ SYMBOL: objects : put-object ( n obj -- ) (objects) set-at ; : cache-object ( obj quot -- value ) - [ (objects) ] dip [ obj>> ] prepose cache ; inline + [ (objects) ] dip '[ obj>> @ ] cache ; inline ! Constants @@ -95,7 +95,7 @@ SYMBOL: objects SYMBOL: sub-primitives : make-jit ( quot rc rt offset -- quad ) - { [ { } make ] [ ] [ ] [ ] } spread 4array ; inline + [ [ { } make ] 3dip ] output>array ; inline : jit-define ( quot rc rt offset name -- ) [ make-jit ] dip set ; inline @@ -524,11 +524,9 @@ M: quotation ' ! Image output : (write-image) ( image -- ) - bootstrap-cell big-endian get [ - [ >be write ] curry each - ] [ - [ >le write ] curry each - ] if ; + bootstrap-cell big-endian get + [ '[ _ >be write ] each ] + [ '[ _ >le write ] each ] if ; : write-image ( image -- ) "Writing image to " write diff --git a/basis/deques/deques.factor b/basis/deques/deques.factor index f4e68c214b..73769cc4d2 100644 --- a/basis/deques/deques.factor +++ b/basis/deques/deques.factor @@ -1,6 +1,6 @@ -! Copyright (C) 2008 Slava Pestov. +! Copyright (C) 2008, 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: kernel sequences math ; +USING: kernel sequences math fry ; IN: deques GENERIC: push-front* ( obj deque -- node ) @@ -34,7 +34,8 @@ GENERIC: deque-empty? ( deque -- ? ) [ peek-back ] [ pop-back* ] bi ; : slurp-deque ( deque quot -- ) - [ drop [ deque-empty? not ] curry ] - [ [ pop-back ] prepose curry ] 2bi [ ] while ; inline + [ drop '[ _ deque-empty? not ] ] + [ '[ _ pop-back @ ] ] + 2bi [ ] while ; inline MIXIN: deque diff --git a/basis/dlists/dlists.factor b/basis/dlists/dlists.factor index dcff476166..8c575105d1 100644 --- a/basis/dlists/dlists.factor +++ b/basis/dlists/dlists.factor @@ -1,8 +1,8 @@ -! Copyright (C) 2007, 2008 Mackenzie Straight, Doug Coleman, +! Copyright (C) 2007, 2009 Mackenzie Straight, Doug Coleman, ! Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: combinators kernel math sequences accessors deques -search-deques summary hashtables ; +search-deques summary hashtables fry ; IN: dlists > ; [ front>> ] dip (dlist-find-node) ; inline : dlist-each-node ( dlist quot -- ) - [ f ] compose dlist-find-node 2drop ; inline + '[ @ f ] dlist-find-node 2drop ; inline : unlink-node ( dlist-node -- ) dup prev>> over next>> set-prev-when @@ -115,8 +115,7 @@ M: dlist pop-back* ( dlist -- ) normalize-front ; : dlist-find ( dlist quot -- obj/f ? ) - [ obj>> ] prepose - dlist-find-node [ obj>> t ] [ drop f f ] if ; inline + '[ obj>> @ ] dlist-find-node [ obj>> t ] [ drop f f ] if ; inline : dlist-contains? ( dlist quot -- ? ) dlist-find nip ; inline @@ -143,7 +142,7 @@ M: dlist delete-node ( dlist-node dlist -- ) ] if ; inline : 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 -- ) f >>front @@ -151,7 +150,7 @@ M: dlist clear-deque ( dlist -- ) drop ; : dlist-each ( dlist quot -- ) - [ obj>> ] prepose dlist-each-node ; inline + '[ obj>> @ ] dlist-each-node ; inline : dlist>seq ( dlist -- seq ) [ ] accumulator [ dlist-each ] dip ; @@ -159,8 +158,6 @@ M: dlist clear-deque ( dlist -- ) : 1dlist ( obj -- dlist ) [ push-front ] keep ; M: dlist clone - [ - [ push-back ] curry dlist-each - ] keep ; + [ '[ _ push-back ] dlist-each ] keep ; INSTANCE: dlist deque diff --git a/basis/grouping/grouping.factor b/basis/grouping/grouping.factor index 14210d6070..ec13e3a750 100644 --- a/basis/grouping/grouping.factor +++ b/basis/grouping/grouping.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2005, 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: kernel math math.order strings arrays vectors sequences -sequences.private accessors ; +sequences.private accessors fry ; IN: grouping ] dip - [ first2-unsafe ] prepose all? + '[ first2-unsafe @ ] all? ] if ] if ; inline diff --git a/basis/unix/process/process.factor b/basis/unix/process/process.factor index 6e83ea9a42..22757cdbe1 100644 --- a/basis/unix/process/process.factor +++ b/basis/unix/process/process.factor @@ -1,6 +1,6 @@ USING: kernel alien.c-types alien.strings sequences math alien.syntax unix 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 ! 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 ; : with-fork ( child parent -- ) - [ [ fork-process dup zero? ] dip [ drop ] prepose ] dip + [ [ fork-process dup zero? ] dip '[ drop @ ] ] dip if ; inline CONSTANT: SIGKILL 9