diff options
| -rw-r--r-- | challenge-134/abigail/README.md | 6 | ||||
| -rw-r--r-- | challenge-134/abigail/tcl/ch-1.tcl | 13 | ||||
| -rw-r--r-- | challenge-134/abigail/tcl/ch-2.tcl | 19 |
3 files changed, 36 insertions, 2 deletions
diff --git a/challenge-134/abigail/README.md b/challenge-134/abigail/README.md index 7e426e1c10..72ad1c8f12 100644 --- a/challenge-134/abigail/README.md +++ b/challenge-134/abigail/README.md @@ -15,7 +15,8 @@ * [Node.js](node/ch-1.js) * [Perl](perl/ch-1.pl) * [Python](python/ch-1.py) -* [Ruby](ruby/ch-1.py) +* [Ruby](ruby/ch-1.rb) +* [Tcl](tcl/ch-1.tcl) ## Part 2 @@ -29,4 +30,5 @@ * [Node.js](node/ch-2.js) * [Perl](perl/ch-2.pl) * [Python](python/ch-2.py) -* [Ruby](ruby/ch-2.py) +* [Ruby](ruby/ch-2.rb) +* [Tcl](tcl/ch-2.tcl) diff --git a/challenge-134/abigail/tcl/ch-1.tcl b/challenge-134/abigail/tcl/ch-1.tcl new file mode 100644 index 0000000000..c6986fe043 --- /dev/null +++ b/challenge-134/abigail/tcl/ch-1.tcl @@ -0,0 +1,13 @@ +# +# See ../README.md +# + +# +# Run as: tclsh ch-1.tcl +# + +array set tail {0 789 1 798 2 879 3 897 4 978} + +for {set i 0} {$i < [array size tail]} {incr i} { + puts "1023456$tail($i)" +} diff --git a/challenge-134/abigail/tcl/ch-2.tcl b/challenge-134/abigail/tcl/ch-2.tcl new file mode 100644 index 0000000000..534913afcd --- /dev/null +++ b/challenge-134/abigail/tcl/ch-2.tcl @@ -0,0 +1,19 @@ +# +# See ../README.md +# + +# +# Run as: tclsh ch-2.tcl < input-file +# + +while {[gets stdin line] >= 0} { + lassign [split $line " "] n m + array set seen { } + for {set i 1} {$i <= $n} {incr i} { + for {set j 1} {$j <= $m} {incr j} { + set p [expr $i * $j] + set seen($p) 1 + } + } + puts [array size seen] +} |
