Replace '<file-reader> contents' with 'file-contents' in all vocabs

db4
Aaron Schaefer 2007-12-31 14:47:24 -05:00
parent 2f04bfadbe
commit 897a8ed8aa
13 changed files with 65 additions and 65 deletions

View File

@ -27,4 +27,4 @@ DEFER: crc32-table inline
: crc32 ( seq -- n ) : crc32 ( seq -- n )
>r HEX: ffffffff dup r> [ (crc32) ] each bitxor ; >r HEX: ffffffff dup r> [ (crc32) ] each bitxor ;
: file-crc32 ( path -- n ) <file-reader> contents crc32 ; : file-crc32 ( path -- n ) file-contents crc32 ;

View File

@ -23,11 +23,11 @@ USING: tools.test io.files io threads kernel ;
] unit-test ] unit-test
[ "Hello world.\nHello appender.\n" ] [ [ "Hello world.\nHello appender.\n" ] [
"test-foo.txt" resource-path <file-reader> contents "test-foo.txt" resource-path file-contents
] unit-test ] unit-test
[ "Hello appender.\n" ] [ [ "Hello appender.\n" ] [
"test-bar.txt" resource-path <file-reader> contents "test-bar.txt" resource-path file-contents
] unit-test ] unit-test
[ ] [ "test-foo.txt" resource-path delete-file ] unit-test [ ] [ "test-foo.txt" resource-path delete-file ] unit-test

View File

@ -63,7 +63,7 @@ uses definitions ;
: reset-checksums ( -- ) : reset-checksums ( -- )
source-files get [ source-files get [
swap ?resource-path dup exists? swap ?resource-path dup exists?
[ <file-reader> contents record-checksum ] [ 2drop ] if [ file-contents record-checksum ] [ 2drop ] if
] assoc-each ; ] assoc-each ;
M: pathname where pathname-string 1 2array ; M: pathname where pathname-string 1 2array ;

View File

@ -151,8 +151,8 @@ tools.test io io.files continuations alien.c-types splitting generic.math ;
[ [
! envelope ! envelope
CRYPT_FORMAT_CRYPTLIB [ CRYPT_FORMAT_CRYPTLIB [
"extra/cryptlib/test/large_data.txt" resource-path <file-reader> "extra/cryptlib/test/large_data.txt" resource-path
contents set-pop-buffer file-contents set-pop-buffer
envelope-handle CRYPT_ATTRIBUTE_BUFFERSIZE envelope-handle CRYPT_ATTRIBUTE_BUFFERSIZE
get-pop-buffer alien>char-string length 10000 + set-attribute get-pop-buffer alien>char-string length 10000 + set-attribute
envelope-handle CRYPT_ENVINFO_DATASIZE envelope-handle CRYPT_ENVINFO_DATASIZE
@ -192,7 +192,7 @@ tools.test io io.files continuations alien.c-types splitting generic.math ;
CRYPT_FORMAT_CRYPTLIB [ CRYPT_FORMAT_CRYPTLIB [
envelope-handle CRYPT_ENVINFO_PASSWORD "password" set-attribute-string envelope-handle CRYPT_ENVINFO_PASSWORD "password" set-attribute-string
"extra/cryptlib/test/large_data.txt" resource-path "extra/cryptlib/test/large_data.txt" resource-path
<file-reader> contents set-pop-buffer file-contents set-pop-buffer
envelope-handle CRYPT_ATTRIBUTE_BUFFERSIZE envelope-handle CRYPT_ATTRIBUTE_BUFFERSIZE
get-pop-buffer alien>char-string length 10000 + set-attribute get-pop-buffer alien>char-string length 10000 + set-attribute
envelope-handle CRYPT_ENVINFO_DATASIZE envelope-handle CRYPT_ENVINFO_DATASIZE

View File

@ -81,11 +81,11 @@ IN: html.parser.analyzer
! ] if ; ! ] if ;
! clear "/Users/erg/web/fark.html" <file-reader> contents parse-html find-links [ "go.pl" swap start ] subset [ "=" split peek ] map ! clear "/Users/erg/web/fark.html" file-contents parse-html find-links [ "go.pl" swap start ] subset [ "=" split peek ] map
! clear "http://fark.com" http-get parse-html find-links [ "go.pl" swap start ] subset [ "=" split peek ] map ! clear "http://fark.com" http-get parse-html find-links [ "go.pl" swap start ] subset [ "=" split peek ] map
! clear "/Users/erg/web/hostels.html" <file-reader> contents parse-html "Currency" "name" pick find-first-attribute-key-value ! clear "/Users/erg/web/hostels.html" file-contents parse-html "Currency" "name" pick find-first-attribute-key-value
! clear "/Users/erg/web/hostels.html" <file-reader> contents parse-html ! clear "/Users/erg/web/hostels.html" file-contents parse-html
! "Currency" "name" pick find-first-attribute-key-value ! "Currency" "name" pick find-first-attribute-key-value
! pick find-between remove-blank-text ! pick find-between remove-blank-text

View File

@ -1,18 +1,14 @@
USING: io io.files io.streams.string http.server.templating USING: io io.files io.streams.string http.server.templating kernel tools.test
kernel tools.test sequences ; sequences ;
IN: temporary IN: temporary
: test-template ( path -- ? ) : test-template ( path -- ? )
"extra/http/server/templating/test/" swap append "extra/http/server/templating/test/" swap append
[ [
".fhtml" append resource-path ".fhtml" append resource-path
[ run-template-file ] string-out [ run-template-file ] string-out
] keep ] keep
".html" append resource-path file-contents = ;
".html" append resource-path
<file-reader> contents
= ;
[ t ] [ "example" test-template ] unit-test [ t ] [ "example" test-template ] unit-test
[ t ] [ "bug" test-template ] unit-test [ t ] [ "bug" test-template ] unit-test

View File

@ -82,7 +82,7 @@ DEFER: <% delimiter
templating-vocab use+ templating-vocab use+
dup source-file file set ! so that reload works properly dup source-file file set ! so that reload works properly
[ [
?resource-path <file-reader> contents ?resource-path file-contents
[ eval-template ] [ html-error. drop ] recover [ eval-template ] [ html-error. drop ] recover
] keep ] keep
] with-scope ] with-scope

View File

@ -1,9 +1,7 @@
! Copyright (C) 2007 Gavin Harrison ! Copyright (C) 2007 Gavin Harrison
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: kernel math sequences kernel.private namespaces arrays io io.files
USING: kernel math sequences kernel.private namespaces arrays splitting io.binary math.functions vectors quotations combinators.private ;
io io.files splitting io.binary math.functions vectors
quotations combinators.private ;
IN: icfp.2006 IN: icfp.2006
SYMBOL: regs SYMBOL: regs
@ -129,7 +127,7 @@ SYMBOL: open-arrays
[ run-op exec-loop ] unless ; [ run-op exec-loop ] unless ;
: load-platters ( path -- ) : load-platters ( path -- )
<file-reader> contents 4 group [ be> ] map file-contents 4 group [ be> ] map
0 arrays get set-nth ; 0 arrays get set-nth ;
: init ( path -- ) : init ( path -- )

View File

@ -1,11 +1,9 @@
USING: io io.mmap io.files kernel tools.test continuations USING: io io.mmap io.files kernel tools.test continuations sequences ;
sequences ;
IN: temporary IN: temporary
[ "mmap-test-file.txt" resource-path delete-file ] catch drop [ "mmap-test-file.txt" resource-path delete-file ] catch drop
[ ] [ "mmap-test-file.txt" resource-path <file-writer> [ "12345" write ] with-stream ] unit-test [ ] [ "mmap-test-file.txt" resource-path <file-writer> [ "12345" write ] with-stream ] unit-test
[ ] [ "mmap-test-file.txt" resource-path dup file-length [ CHAR: 2 0 pick set-nth drop ] with-mapped-file ] unit-test [ ] [ "mmap-test-file.txt" resource-path dup file-length [ CHAR: 2 0 pick set-nth drop ] with-mapped-file ] unit-test
[ 5 ] [ "mmap-test-file.txt" resource-path dup file-length [ length ] with-mapped-file ] unit-test [ 5 ] [ "mmap-test-file.txt" resource-path dup file-length [ length ] with-mapped-file ] unit-test
[ "22345" ] [ "mmap-test-file.txt" resource-path <file-reader> contents ] unit-test [ "22345" ] [ "mmap-test-file.txt" resource-path file-contents ] unit-test
[ "mmap-test-file.txt" resource-path delete-file ] catch drop [ "mmap-test-file.txt" resource-path delete-file ] catch drop

View File

@ -38,7 +38,7 @@ IN: project-euler.022
] "" make ; ] "" make ;
: source-022 ( -- seq ) : source-022 ( -- seq )
(source-022) <file-reader> contents [ quotable? ] subset "," split ; (source-022) file-contents [ quotable? ] subset "," split ;
: alpha-value ( str -- n ) : alpha-value ( str -- n )
string>digits [ 9 - ] sigma ; string>digits [ 9 - ] sigma ;

View File

@ -38,12 +38,12 @@ IN: project-euler.067
<PRIVATE <PRIVATE
: pyramid ( -- seq ) : pyramid ( -- seq )
"resource:extra/project-euler/067/triangle.txt" ?resource-path <file-reader> "resource:extra/project-euler/067/triangle.txt" ?resource-path
lines [ " " split [ string>number ] map ] map ; <file-reader> lines [ " " split [ string>number ] map ] map ;
PRIVATE> PRIVATE>
: euler067 ( -- best ) : euler067 ( -- answer )
pyramid propagate-all first first ; pyramid propagate-all first first ;
! [ euler067 ] 100 ave-time ! [ euler067 ] 100 ave-time

View File

@ -74,6 +74,15 @@ PRIVATE>
: sum-proper-divisors ( n -- sum ) : sum-proper-divisors ( n -- sum )
dup sum-divisors swap - ; dup sum-divisors swap - ;
: abundant? ( n -- ? )
dup sum-proper-divisors < ;
: deficient? ( n -- ? )
dup sum-proper-divisors > ;
: perfect? ( n -- ? )
dup sum-proper-divisors = ;
! The divisor function, counts the number of divisors ! The divisor function, counts the number of divisors
: tau ( n -- n ) : tau ( n -- n )
prime-factorization* flip second 1 [ 1+ * ] reduce ; prime-factorization* flip second 1 [ 1+ * ] reduce ;

View File

@ -1,6 +1,5 @@
USING: xmode.tokens xmode.marker USING: xmode.tokens xmode.marker xmode.catalog kernel html html.elements io
xmode.catalog kernel html html.elements io io.files io.files sequences words ;
sequences words ;
IN: xmode.code2html IN: xmode.code2html
: htmlize-tokens ( tokens -- ) : htmlize-tokens ( tokens -- )
@ -21,7 +20,7 @@ IN: xmode.code2html
: default-stylesheet ( -- ) : default-stylesheet ( -- )
<style> <style>
"extra/xmode/code2html/stylesheet.css" "extra/xmode/code2html/stylesheet.css"
resource-path <file-reader> contents write resource-path file-contents write
</style> ; </style> ;
: htmlize-stream ( path stream -- ) : htmlize-stream ( path stream -- )