Memoize

BasicWerk   EC Support   Technique   Facebook  

20140609213352_factor_io

factor_io

 

http://basicwerk.com/blog/archives/1645

 

with-file-writer

 
IN: scratchpad auto-use USE: io.encodings.utf8
IN: scratchpad auto-use "sample.txt" utf8 [ { 1 2 3 } [ "Number " write number>string print ] each ] with-file-writer
 
% less sample.txt
Number 1
Number 2
Number 3
 

 

print には str を渡す必要があるので、number>string を使う。

 

http://docs.factorcode.org/content/word-with-file-writer%2Cio.files.html

 

 

with-file-reader

 
IN: scratchpad auto-use USING: io kernel ;
IN: scratchpad auto-use "sample.txt" utf8 [ [ print ] each-line ] with-file-reader
Number 1
Number 2
Number 3
 

 

http://docs.factorcode.org/content/word-with-file-reader,io.files.html

 


© Shin Nakamura/BasicWerk 2014