diff --git a/library/bootstrap/boot-stage2.factor b/library/bootstrap/boot-stage2.factor index ce47aba771..1cd2362d80 100644 --- a/library/bootstrap/boot-stage2.factor +++ b/library/bootstrap/boot-stage2.factor @@ -63,9 +63,6 @@ xref-articles 0 exit ] set-boot -"Setting the resource path..." print -cwd "resource-path" set-global - [ compiled? ] word-subset length number>string write " compiled words" print diff --git a/library/collections/sequences-epilogue.factor b/library/collections/sequences-epilogue.factor index 247778780d..f37f61c5c0 100644 --- a/library/collections/sequences-epilogue.factor +++ b/library/collections/sequences-epilogue.factor @@ -15,11 +15,26 @@ sequences-internals strings vectors words ; M: object like drop ; -: index ( obj seq -- n ) [ = ] find-with drop ; flushable -: index* ( obj i seq -- n ) [ = ] find-with* drop ; flushable -: member? ( obj seq -- ? ) [ = ] contains-with? ; flushable -: memq? ( obj seq -- ? ) [ eq? ] contains-with? ; flushable -: remove ( obj list -- list ) [ = not ] subset-with ; flushable +: index ( obj seq -- n ) + [ = ] find-with drop ; flushable + +: index* ( obj i seq -- n ) + [ = ] find-with* drop ; flushable + +: last-index ( obj seq -- n ) + [ = ] find-last-with drop ; flushable + +: last-index* ( obj i seq -- n ) + [ = ] find-last-with* drop ; flushable + +: member? ( obj seq -- ? ) + [ = ] contains-with? ; flushable + +: memq? ( obj seq -- ? ) + [ eq? ] contains-with? ; flushable + +: remove ( obj list -- list ) + [ = not ] subset-with ; flushable : (subst) ( newseq oldseq elt -- new/elt ) [ swap index ] keep diff --git a/library/io/files.factor b/library/io/files.factor index 7123c90fd3..2d63f3b4b2 100644 --- a/library/io/files.factor +++ b/library/io/files.factor @@ -1,8 +1,8 @@ ! Copyright (C) 2004, 2005 Slava Pestov. ! See http://factor.sf.net/license.txt for BSD license. IN: io -USING: hashtables kernel lists math namespaces sequences strings -styles ; +USING: hashtables kernel lists math memory namespaces sequences +strings styles ; ! Words for accessing filesystem meta-data. @@ -19,8 +19,12 @@ styles ; : file-length ( file -- length ) stat third ; +: parent-dir ( path -- path ) + CHAR: / over last-index CHAR: \\ pick last-index max + dup -1 = [ 2drop "." ] [ swap head ] if ; + : resource-path ( path -- path ) - "resource-path" get [ "." ] unless* swap path+ ; + image parent-dir swap path+ ; : ( path -- stream ) #! Open a file path relative to the Factor source code root.