Skip to content

Commit

Permalink
tcl/reverse-string: 1st iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
vpayno committed Apr 12, 2024
1 parent 3592715 commit 9698309
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 3 deletions.
1 change: 1 addition & 0 deletions tcl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@
- [beer-song](./beer-song/README.md)
- [raindrops](./raindrops/README.md)
- [leap](./leap/README.md)
- [reverse-string](./reverse-string/README.md)
7 changes: 6 additions & 1 deletion tcl/reverse-string/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,9 @@ Try to implement this yourself without using those "cheats".

### Based on

Introductory challenge to reverse an input string - https://medium.freecodecamp.org/how-to-reverse-a-string-in-javascript-in-3-different-ways-75e4763c68cb
Introductory challenge to reverse an input string - https://medium.freecodecamp.org/how-to-reverse-a-string-in-javascript-in-3-different-ways-75e4763c68cb

### My Solution

- [reverse-string.tcl](./reverse-string.tcl)
- [run-tests](./run-tests-tcl.txt)
10 changes: 8 additions & 2 deletions tcl/reverse-string/reverse-string.tcl
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
proc reverse {input} {
throw {NOT_IMPLEMENTED} "Implement this procedure."
proc reverse {text} {
set rtext ""

foreach char [lreverse [split $text ""]] {
append rtext $char
}

return $rtext
}
62 changes: 62 additions & 0 deletions tcl/reverse-string/run-tests-tcl.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
Running automated test file(s):


===============================================================================

Running: ttclcheck -scan /home/vpayno/git_vpayno/exercism-workspace/tcl/reverse-string
ttclcheck version: 0.18 Copyright 2013 Artur Trzewik
All Rights Reserved.

GPL licensed software
warn: pass shallow
warn: parsing /home/vpayno/git_vpayno/exercism-workspace/tcl/reverse-string/testHelpers.tcl
warn: parsing /home/vpayno/git_vpayno/exercism-workspace/tcl/reverse-string/reverse-string.tcl
warn: pass collect
warn: parsing /home/vpayno/git_vpayno/exercism-workspace/tcl/reverse-string/testHelpers.tcl
warn: parsing /home/vpayno/git_vpayno/exercism-workspace/tcl/reverse-string/reverse-string.tcl
warn: pass report
warn: parsing /home/vpayno/git_vpayno/exercism-workspace/tcl/reverse-string/testHelpers.tcl
/home/vpayno/git_vpayno/exercism-workspace/tcl/reverse-string/testHelpers.tcl: parsing file /home/vpayno/git_vpayno/exercism-workspace/tcl/reverse-string/testHelpers.tcl
/home/vpayno/git_vpayno/exercism-workspace/tcl/reverse-string/testHelpers.tcl:17: unknown variable ::tcltest::numTests <<$::tcltest::numTests>>
/home/vpayno/git_vpayno/exercism-workspace/tcl/reverse-string/testHelpers.tcl: errors file: 1
warn: parsing /home/vpayno/git_vpayno/exercism-workspace/tcl/reverse-string/reverse-string.tcl
/home/vpayno/git_vpayno/exercism-workspace/tcl/reverse-string/reverse-string.tcl: parsing file /home/vpayno/git_vpayno/exercism-workspace/tcl/reverse-string/reverse-string.tcl
/home/vpayno/git_vpayno/exercism-workspace/tcl/reverse-string/reverse-string.tcl: errors file: 0
errors all: 1 (3.23% lines)
lines: 31 in: 00:00:00 34 lines/sec: 911.76
commands: 3 variables: 1
signature params 5 unknown: 2 40.00% unknown variables 0.00%

real 0m0.092s
user 0m0.076s
sys 0m0.016s

===============================================================================

Running: nagelfar -s _ ./reverse-string.tcl
Checking file ./reverse-string.tcl

real 0m0.031s
user 0m0.026s
sys 0m0.005s

===============================================================================

Running: RUN_ALL=1 tclsh ./reverse-string.test
reverse-string.test: Total 7 Passed 7 Skipped 0 Failed 0

real 0m0.010s
user 0m0.005s
sys 0m0.005s


===============================================================================

Running: misspell .

real 0m0.018s
user 0m0.022s
sys 0m0.009s

===============================================================================

0 comments on commit 9698309

Please sign in to comment.