Replace '<file-reader> contents' with 'file-contents' in all vocabs
parent
2f04bfadbe
commit
897a8ed8aa
|
@ -27,4 +27,4 @@ DEFER: crc32-table inline
|
|||
: crc32 ( seq -- n )
|
||||
>r HEX: ffffffff dup r> [ (crc32) ] each bitxor ;
|
||||
|
||||
: file-crc32 ( path -- n ) <file-reader> contents crc32 ;
|
||||
: file-crc32 ( path -- n ) file-contents crc32 ;
|
||||
|
|
|
@ -23,11 +23,11 @@ USING: tools.test io.files io threads kernel ;
|
|||
] unit-test
|
||||
|
||||
[ "Hello world.\nHello appender.\n" ] [
|
||||
"test-foo.txt" resource-path <file-reader> contents
|
||||
"test-foo.txt" resource-path file-contents
|
||||
] unit-test
|
||||
|
||||
[ "Hello appender.\n" ] [
|
||||
"test-bar.txt" resource-path <file-reader> contents
|
||||
"test-bar.txt" resource-path file-contents
|
||||
] unit-test
|
||||
|
||||
[ ] [ "test-foo.txt" resource-path delete-file ] unit-test
|
||||
|
|
|
@ -63,7 +63,7 @@ uses definitions ;
|
|||
: reset-checksums ( -- )
|
||||
source-files get [
|
||||
swap ?resource-path dup exists?
|
||||
[ <file-reader> contents record-checksum ] [ 2drop ] if
|
||||
[ file-contents record-checksum ] [ 2drop ] if
|
||||
] assoc-each ;
|
||||
|
||||
M: pathname where pathname-string 1 2array ;
|
||||
|
|
|
@ -151,8 +151,8 @@ tools.test io io.files continuations alien.c-types splitting generic.math ;
|
|||
[
|
||||
! envelope
|
||||
CRYPT_FORMAT_CRYPTLIB [
|
||||
"extra/cryptlib/test/large_data.txt" resource-path <file-reader>
|
||||
contents set-pop-buffer
|
||||
"extra/cryptlib/test/large_data.txt" resource-path
|
||||
file-contents set-pop-buffer
|
||||
envelope-handle CRYPT_ATTRIBUTE_BUFFERSIZE
|
||||
get-pop-buffer alien>char-string length 10000 + set-attribute
|
||||
envelope-handle CRYPT_ENVINFO_DATASIZE
|
||||
|
@ -192,7 +192,7 @@ tools.test io io.files continuations alien.c-types splitting generic.math ;
|
|||
CRYPT_FORMAT_CRYPTLIB [
|
||||
envelope-handle CRYPT_ENVINFO_PASSWORD "password" set-attribute-string
|
||||
"extra/cryptlib/test/large_data.txt" resource-path
|
||||
<file-reader> contents set-pop-buffer
|
||||
file-contents set-pop-buffer
|
||||
envelope-handle CRYPT_ATTRIBUTE_BUFFERSIZE
|
||||
get-pop-buffer alien>char-string length 10000 + set-attribute
|
||||
envelope-handle CRYPT_ENVINFO_DATASIZE
|
||||
|
|
|
@ -81,11 +81,11 @@ IN: html.parser.analyzer
|
|||
! ] 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 "/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
|
||||
! pick find-between remove-blank-text
|
||||
|
|
|
@ -1,18 +1,14 @@
|
|||
USING: io io.files io.streams.string http.server.templating
|
||||
kernel tools.test sequences ;
|
||||
USING: io io.files io.streams.string http.server.templating kernel tools.test
|
||||
sequences ;
|
||||
IN: temporary
|
||||
|
||||
: test-template ( path -- ? )
|
||||
"extra/http/server/templating/test/" swap append
|
||||
|
||||
[
|
||||
".fhtml" append resource-path
|
||||
[ run-template-file ] string-out
|
||||
] keep
|
||||
|
||||
".html" append resource-path
|
||||
<file-reader> contents
|
||||
= ;
|
||||
".html" append resource-path file-contents = ;
|
||||
|
||||
[ t ] [ "example" test-template ] unit-test
|
||||
[ t ] [ "bug" test-template ] unit-test
|
||||
|
|
|
@ -82,7 +82,7 @@ DEFER: <% delimiter
|
|||
templating-vocab use+
|
||||
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
|
||||
] keep
|
||||
] with-scope
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
! Copyright (C) 2007 Gavin Harrison
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
|
||||
USING: kernel math sequences kernel.private namespaces arrays
|
||||
io io.files splitting io.binary math.functions vectors
|
||||
quotations combinators.private ;
|
||||
USING: kernel math sequences kernel.private namespaces arrays io io.files
|
||||
splitting io.binary math.functions vectors quotations combinators.private ;
|
||||
IN: icfp.2006
|
||||
|
||||
SYMBOL: regs
|
||||
|
@ -129,7 +127,7 @@ SYMBOL: open-arrays
|
|||
[ run-op exec-loop ] unless ;
|
||||
|
||||
: load-platters ( path -- )
|
||||
<file-reader> contents 4 group [ be> ] map
|
||||
file-contents 4 group [ be> ] map
|
||||
0 arrays get set-nth ;
|
||||
|
||||
: init ( path -- )
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
USING: io io.mmap io.files kernel tools.test continuations
|
||||
sequences ;
|
||||
USING: io io.mmap io.files kernel tools.test continuations sequences ;
|
||||
IN: temporary
|
||||
|
||||
[ "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 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
|
||||
[ "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
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ IN: project-euler.022
|
|||
] "" make ;
|
||||
|
||||
: source-022 ( -- seq )
|
||||
(source-022) <file-reader> contents [ quotable? ] subset "," split ;
|
||||
(source-022) file-contents [ quotable? ] subset "," split ;
|
||||
|
||||
: alpha-value ( str -- n )
|
||||
string>digits [ 9 - ] sigma ;
|
||||
|
|
|
@ -38,12 +38,12 @@ IN: project-euler.067
|
|||
<PRIVATE
|
||||
|
||||
: pyramid ( -- seq )
|
||||
"resource:extra/project-euler/067/triangle.txt" ?resource-path <file-reader>
|
||||
lines [ " " split [ string>number ] map ] map ;
|
||||
"resource:extra/project-euler/067/triangle.txt" ?resource-path
|
||||
<file-reader> lines [ " " split [ string>number ] map ] map ;
|
||||
|
||||
PRIVATE>
|
||||
|
||||
: euler067 ( -- best )
|
||||
: euler067 ( -- answer )
|
||||
pyramid propagate-all first first ;
|
||||
|
||||
! [ euler067 ] 100 ave-time
|
||||
|
|
|
@ -74,6 +74,15 @@ PRIVATE>
|
|||
: sum-proper-divisors ( n -- sum )
|
||||
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
|
||||
: tau ( n -- n )
|
||||
prime-factorization* flip second 1 [ 1+ * ] reduce ;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
USING: xmode.tokens xmode.marker
|
||||
xmode.catalog kernel html html.elements io io.files
|
||||
sequences words ;
|
||||
USING: xmode.tokens xmode.marker xmode.catalog kernel html html.elements io
|
||||
io.files sequences words ;
|
||||
IN: xmode.code2html
|
||||
|
||||
: htmlize-tokens ( tokens -- )
|
||||
|
@ -21,7 +20,7 @@ IN: xmode.code2html
|
|||
: default-stylesheet ( -- )
|
||||
<style>
|
||||
"extra/xmode/code2html/stylesheet.css"
|
||||
resource-path <file-reader> contents write
|
||||
resource-path file-contents write
|
||||
</style> ;
|
||||
|
||||
: htmlize-stream ( path stream -- )
|
||||
|
|
Loading…
Reference in New Issue