search for: load_file2

Displaying 2 results from an estimated 2 matches for "load_file2".

Did you mean: load_file
2008 Jan 18
2
NameError when using alias_method -- but method exists?
Hello Rubyists, I am a bit stumped here. I want to extend the ''load_file'' method in the YAML module. Following along with the PickAxe example of making old methods do new things, I try this in irb: >> module YAML >> alias_method :orig_load_f, :load_file >> def load_file(*args) >> contents = orig_load_f(*args) >>
2012 Apr 01
1
scan() vs readChar() speed
...timize the memory allocation), load_file1 <- function(f){ ## ask wc the number of words n <- scan(textConnection(system(paste("wc -w ", f), intern=TRUE)), what=list(integer(), character()), quiet=TRUE)[[1]] all <- scan(f, nmax=n, quiet=TRUE) invisible(all) } load_file2 <- function(f){ ## ask wc the number of characters n <- scan(textConnection(system(paste("wc -m ", f), intern=TRUE)), what=list(integer(), character()), quiet=TRUE)[[1]] tc <- textConnection(readChar(f, n)) all <- scan(tc, quiet=TRUE, multi.line = FALSE)...