A: Recently I've been encouraging the addition of a method named "r
" (for reload) at the end of each .rb
file.
For example, in re.rb
, have this:
def r load "re.rb" endYou'll still to load the file once by hand, either with
irb -r ./re.rb
or load "re.rb"
, but once that's done,
just type r
to load the latest.
Hint: Just type r
! (I've seen a few students hit up-arrow until they get
back to the r
and then hit ENTER. I'm not kidding!)
diff
that will put differing lines close to each other?
diff -u
. As Using the Tester points out, a tester
diff is followed with the names of the files diff'd (underlined):
... Test: 'ulimit -t 2; ruby a7/re1.rb sen < a7/re.sen': FAILED Differences (expected/actual): *** a7/master/tester.out/sen.out.01 2016-03-25 12:57:28.000000000 -0700 --- tester.out/sen.out.01 2018-04-03 01:27:37.094132320 -0700 ...not shown... Files diffed: a7/master/tester.out/sen.out.01 tester.out/sen.out.01Let's tack those names onto
diff -u
:
$ diff -u a7/master/tester.out/sen.out.01 tester.out/sen.out.01 --- a7/master/tester.out/sen.out.01 2016-03-25 12:57:28.000000000 -0700 +++ tester.out/sen.out.01 2018-04-03 01:27:37.094132320 -0700 @@ -1,7 +1,7 @@ Yes: "X." Yes: "I shall test this." Yes: "It worked!?" -Yes: "It worked?!" +No: "It worked?!" Yes: "In this problem you are to write four methods." Yes: "Is THIS a valid sentence?" Yes: "That is valid!"Yes, there should be a tester option to select the type of diff. Maybe I'll add that if there's some clamoring for it.
None yet!
re.rb
, smg.txt
was cited as smb.txt
.
re.rb
, there was "72" instead of "72 hours".
vstring.rb
, the example of resolution .new was omitted: s = ReplString.new("abc",10)
vstring.rb
write-up, on page 16 of the printed copies, an HTML markup error led to only a fragment of the output for cat a7/mkfile.rb
being shown. The printed write-ups have this:
$ cat a7/mkfile.rb prog = <&1` puts "Program output: (#{result.size} bytes)", resultIt should be this:
$ cat a7/mkfile.rb prog = <<X public class hello { public static void main(String args[]) { System.out.println("Hello, #{ARGV[0]}!"); } } X # IMPORTANT: That X just above MUST BE IN THE FIRST COLUMN! f = File.new("hello.java","w") f.write(prog) f.close result = `bash -c "javac hello.java && java hello" 2>&1` puts "Program output: (#{result.size} bytes)", result
optab
write-up, just below cat checkop.hs
, the following line was duplicated:
>> result = `bash -c "ghci -ignore-dot-ghci < checkop.hs" 2>&1`
new Object()
instead of just new Object