Skip to content

Commit 34d1ee0

Browse files
committed
Generated Sample Programs website automatically
on-behalf-of: @TheRenegadeCoder <jeremy.grifski@therenegadecoder.com>
1 parent f50ed10 commit 34d1ee0

File tree

9 files changed

+295
-27
lines changed

9 files changed

+295
-27
lines changed

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ layout: default
55
title: Sample Programs in Every Language
66
---
77

8-
Welcome to Sample Programs in Every Language, a collection of code snippets in as many languages as possible. Thanks for taking an interest in our collection which currently contains 1490 articles written by 281 authors.
8+
Welcome to Sample Programs in Every Language, a collection of code snippets in as many languages as possible. Thanks for taking an interest in our collection which currently contains 1493 articles written by 281 authors.
99

1010
If you'd like to contribute to this growing collection, check out our [contributing document](https://github.com/TheRenegadeCoder/sample-programs/blob/master/.github/CONTRIBUTING.md) for more information. In addition, you can explore our documentation which is organized by [project](/projects) and by [language](/languages). If you don't find what you're look for, check out our list of related [open-source projects](/related). Finally, if code isn't your thing but you'd still like to help, there are plenty of other ways to [support the project](https://therenegadecoder.com/updates/5-ways-you-can-support-the-renegade-coder/).

docs/languages/index.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ layout: default
66
title: Programming Languages
77
---
88

9-
Welcome to the Languages page! Here, you'll find a list of all of the languages represented in the collection. At this time, there are 156 languages, of which 155 are tested, 1 is untestable, and 1296 code snippets.
9+
Welcome to the Languages page! Here, you'll find a list of all of the languages represented in the collection. At this time, there are 156 languages, of which 155 are tested, 1 is untestable, and 1299 code snippets.
1010

1111
## Language Breakdown
1212

@@ -18,43 +18,43 @@ Here are the percentages for each language in the collection:
1818

1919
<tr>
2020
<td class="right nowrap">Algol68</td>
21-
<td class="right">7.34%</td>
21+
<td class="right">7.33%</td>
2222
<td class="bar-graph"><div style="width: 100.00%; background-color: #AF425E;"></div></td>
2323
</tr>
2424

2525
<tr>
2626
<td class="right nowrap">Commodore Basic</td>
27-
<td class="right">7.25%</td>
27+
<td class="right">7.24%</td>
2828
<td class="bar-graph"><div style="width: 98.72%; background-color: #4F44D8;"></div></td>
2929
</tr>
3030

3131
<tr>
3232
<td class="right nowrap">Euphoria</td>
33-
<td class="right">6.42%</td>
33+
<td class="right">6.41%</td>
3434
<td class="bar-graph"><div style="width: 87.42%; background-color: #FF790B;"></div></td>
3535
</tr>
3636

3737
<tr>
3838
<td class="right nowrap">Beef</td>
39-
<td class="right">6.18%</td>
39+
<td class="right">6.17%</td>
4040
<td class="bar-graph"><div style="width: 84.19%; background-color: #A52F4E;"></div></td>
4141
</tr>
4242

4343
<tr>
4444
<td class="right nowrap">Pascal</td>
45-
<td class="right">5.24%</td>
45+
<td class="right">5.23%</td>
4646
<td class="bar-graph"><div style="width: 71.34%; background-color: #E3F171;"></div></td>
4747
</tr>
4848

4949
<tr>
5050
<td class="right nowrap">Rust</td>
51-
<td class="right">4.58%</td>
51+
<td class="right">4.57%</td>
5252
<td class="bar-graph"><div style="width: 62.35%; background-color: #DEA584;"></div></td>
5353
</tr>
5454

5555
<tr>
5656
<td class="right nowrap">C</td>
57-
<td class="right">4.54%</td>
57+
<td class="right">4.53%</td>
5858
<td class="bar-graph"><div style="width: 61.81%; background-color: #555555;"></div></td>
5959
</tr>
6060

@@ -72,7 +72,7 @@ Here are the percentages for each language in the collection:
7272

7373
<tr>
7474
<td class="right nowrap">Awk</td>
75-
<td class="right">3.70%</td>
75+
<td class="right">3.69%</td>
7676
<td class="bar-graph"><div style="width: 50.35%; background-color: #C30E9B;"></div></td>
7777
</tr>
7878

@@ -108,13 +108,13 @@ Here are the percentages for each language in the collection:
108108

109109
<tr>
110110
<td class="right nowrap">Javascript</td>
111-
<td class="right">2.19%</td>
111+
<td class="right">2.18%</td>
112112
<td class="bar-graph"><div style="width: 29.79%; background-color: #F1E05A;"></div></td>
113113
</tr>
114114

115115
<tr>
116116
<td class="right nowrap">Python</td>
117-
<td class="right">2.18%</td>
117+
<td class="right">2.17%</td>
118118
<td class="bar-graph"><div style="width: 29.67%; background-color: #3572A5;"></div></td>
119119
</tr>
120120

@@ -126,13 +126,13 @@ Here are the percentages for each language in the collection:
126126

127127
<tr>
128128
<td class="right nowrap">Kotlin</td>
129-
<td class="right">1.44%</td>
129+
<td class="right">1.43%</td>
130130
<td class="bar-graph"><div style="width: 19.58%; background-color: #A97BFF;"></div></td>
131131
</tr>
132132

133133
<tr>
134134
<td class="right nowrap">Typescript</td>
135-
<td class="right">1.28%</td>
135+
<td class="right">1.27%</td>
136136
<td class="bar-graph"><div style="width: 17.39%; background-color: #3178C6;"></div></td>
137137
</tr>
138138

@@ -150,8 +150,8 @@ Here are the percentages for each language in the collection:
150150

151151
<tr>
152152
<td class="right nowrap">Tcl</td>
153-
<td class="right">1.00%</td>
154-
<td class="bar-graph"><div style="width: 13.62%; background-color: #E4CC98;"></div></td>
153+
<td class="right">1.16%</td>
154+
<td class="bar-graph"><div style="width: 15.87%; background-color: #E4CC98;"></div></td>
155155
</tr>
156156

157157
<tr>
@@ -240,7 +240,7 @@ Here are the percentages for each language in the collection:
240240

241241
<tr>
242242
<td class="right nowrap">Elixir</td>
243-
<td class="right">0.44%</td>
243+
<td class="right">0.43%</td>
244244
<td class="bar-graph"><div style="width: 5.93%; background-color: #6E4A7E;"></div></td>
245245
</tr>
246246

@@ -1263,9 +1263,9 @@ The 'S' collection contains 10 languages, of which 10 are tested, and 41 code sn
12631263

12641264
### T
12651265

1266-
The 'T' collection contains 5 languages, of which 5 are tested, and 56 code snippets.
1266+
The 'T' collection contains 5 languages, of which 5 are tested, and 59 code snippets.
12671267

1268-
- [Tcl](https://sampleprograms.io/languages/tcl) (15 code snippets)
1268+
- [Tcl](https://sampleprograms.io/languages/tcl) (18 code snippets)
12691269
- [Terra](https://sampleprograms.io/languages/terra) (2 code snippets)
12701270
- [Tex](https://sampleprograms.io/languages/tex) (3 code snippets)
12711271
- [Ti Basic](https://sampleprograms.io/languages/ti-basic) (13 code snippets)

docs/languages/tcl/index.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ No 'Description' section available. [Please consider contributing](https://githu
2626

2727
## Articles
2828

29-
There are 15 articles:
29+
There are 18 articles:
3030

3131
- [Baklava in Tcl](https://sampleprograms.io/projects/baklava/tcl)
3232
- [Base64 Encode Decode in Tcl](https://sampleprograms.io/projects/base64-encode-decode/tcl)
@@ -42,4 +42,7 @@ There are 15 articles:
4242
- [Fibonacci in Tcl](https://sampleprograms.io/projects/fibonacci/tcl)
4343
- [File Input Output in Tcl](https://sampleprograms.io/projects/file-input-output/tcl)
4444
- [Fizz Buzz in Tcl](https://sampleprograms.io/projects/fizz-buzz/tcl)
45-
- [Hello World in Tcl](https://sampleprograms.io/projects/hello-world/tcl)
45+
- [Hello World in Tcl](https://sampleprograms.io/projects/hello-world/tcl)
46+
- [Josephus Problem in Tcl](https://sampleprograms.io/projects/josephus-problem/tcl)
47+
- [Linear Search in Tcl](https://sampleprograms.io/projects/linear-search/tcl)
48+
- [Longest Word in Tcl](https://sampleprograms.io/projects/longest-word/tcl)

docs/projects/josephus-problem/index.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
date: 2021-10-08
33
featured-image: josephus-problem-in-every-language.jpg
4-
last-modified: 2025-08-16
4+
last-modified: 2025-10-09
55
layout: default
66
tags:
77
- josephus-problem
@@ -94,7 +94,7 @@ Usage: please input the total number of people and number of people to skip.
9494

9595
## Articles
9696

97-
There are 18 articles:
97+
There are 19 articles:
9898

9999
- [Josephus Problem in Algol68](https://sampleprograms.io/projects/josephus-problem/algol68)
100100
- [Josephus Problem in Awk](https://sampleprograms.io/projects/josephus-problem/awk)
@@ -113,6 +113,7 @@ There are 18 articles:
113113
- [Josephus Problem in Python](https://sampleprograms.io/projects/josephus-problem/python)
114114
- [Josephus Problem in Ruby](https://sampleprograms.io/projects/josephus-problem/ruby)
115115
- [Josephus Problem in Rust](https://sampleprograms.io/projects/josephus-problem/rust)
116+
- [Josephus Problem in Tcl](https://sampleprograms.io/projects/josephus-problem/tcl)
116117
- [Josephus Problem in Ti Basic](https://sampleprograms.io/projects/josephus-problem/ti-basic)
117118

118119
***
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
---
2+
authors:
3+
- "\u0218tefan-Iulian Alecu"
4+
date: 2025-10-09
5+
featured-image: josephus-problem-in-every-language.jpg
6+
last-modified: 2025-10-09
7+
layout: default
8+
tags:
9+
- josephus-problem
10+
- tcl
11+
title: Josephus Problem in Tcl
12+
---
13+
14+
<!--
15+
AUTO-GENERATED -- PLEASE DO NOT EDIT!
16+
17+
Instead, please edit the following:
18+
19+
- sources/programs/josephus-problem/tcl/how-to-implement-the-solution.md
20+
- sources/programs/josephus-problem/tcl/how-to-run-the-solution.md
21+
22+
See .github/CONTRIBUTING.md for further details.
23+
-->
24+
25+
Welcome to the [Josephus Problem](https://sampleprograms.io/projects/josephus-problem) in [Tcl](https://sampleprograms.io/languages/tcl) page! Here, you'll find the source code for this program as well as a description of how the program works.
26+
27+
## Current Solution
28+
29+
{% raw %}
30+
31+
```tcl
32+
proc usage {} {
33+
puts stderr {Usage: please input the total number of people and number of people to skip.}
34+
exit 1
35+
}
36+
37+
proc parseInt {s} {
38+
set s [string trim $s]
39+
if {[string is integer -strict $s]} { return $s }
40+
usage
41+
}
42+
43+
proc josephus {total skip} {
44+
if {$skip < 1 || $total < 1} { usage }
45+
46+
# If skip = 1, survivor is the last person
47+
if {$skip == 1} { return $total }
48+
49+
# Optimized case for skip = 2
50+
if {$skip == 2} {
51+
set power 1
52+
while {($power << 1) <= $total} {
53+
set power [expr {$power << 1}]
54+
}
55+
return [expr {2 * ($total - $power) + 1}]
56+
}
57+
58+
set result 0
59+
for {set i 2} {$i <= $total} {incr i} {
60+
set result [expr {($result + $skip) % $i}]
61+
}
62+
63+
return [expr {$result + 1}]
64+
}
65+
66+
if {$argc != 2} { usage }
67+
68+
set total [parseInt [lindex $argv 0]]
69+
set skip [parseInt [lindex $argv 1]]
70+
71+
puts [josephus $total $skip]
72+
73+
```
74+
75+
{% endraw %}
76+
77+
Josephus Problem in [Tcl](https://sampleprograms.io/languages/tcl) was written by:
78+
79+
- Ștefan-Iulian Alecu
80+
81+
If you see anything you'd like to change or update, [please consider contributing](https://github.com/TheRenegadeCoder/sample-programs).
82+
83+
## How to Implement the Solution
84+
85+
No 'How to Implement the Solution' section available. [Please consider contributing](https://github.com/TheRenegadeCoder/sample-programs-website).
86+
87+
## How to Run the Solution
88+
89+
No 'How to Run the Solution' section available. [Please consider contributing](https://github.com/TheRenegadeCoder/sample-programs-website).

docs/projects/linear-search/index.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
date: 2019-10-17
33
featured-image: linear-search-in-every-language.jpg
4-
last-modified: 2025-09-03
4+
last-modified: 2025-10-09
55
layout: default
66
tags:
77
- linear-search
@@ -127,7 +127,7 @@ Usage: please provide a list of integers ("1, 4, 5, 11, 12") and the integer to
127127

128128
## Articles
129129

130-
There are 22 articles:
130+
There are 23 articles:
131131

132132
- [Linear Search in Algol68](https://sampleprograms.io/projects/linear-search/algol68)
133133
- [Linear Search in Awk](https://sampleprograms.io/projects/linear-search/awk)
@@ -150,6 +150,7 @@ There are 22 articles:
150150
- [Linear Search in Powershell](https://sampleprograms.io/projects/linear-search/powershell)
151151
- [Linear Search in Python](https://sampleprograms.io/projects/linear-search/python)
152152
- [Linear Search in Rust](https://sampleprograms.io/projects/linear-search/rust)
153+
- [Linear Search in Tcl](https://sampleprograms.io/projects/linear-search/tcl)
153154
- [Linear Search in Typescript](https://sampleprograms.io/projects/linear-search/typescript)
154155

155156
***
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
---
2+
authors:
3+
- "\u0218tefan-Iulian Alecu"
4+
date: 2025-10-09
5+
featured-image: linear-search-in-every-language.jpg
6+
last-modified: 2025-10-09
7+
layout: default
8+
tags:
9+
- linear-search
10+
- tcl
11+
title: Linear Search in Tcl
12+
---
13+
14+
<!--
15+
AUTO-GENERATED -- PLEASE DO NOT EDIT!
16+
17+
Instead, please edit the following:
18+
19+
- sources/programs/linear-search/tcl/how-to-implement-the-solution.md
20+
- sources/programs/linear-search/tcl/how-to-run-the-solution.md
21+
22+
See .github/CONTRIBUTING.md for further details.
23+
-->
24+
25+
Welcome to the [Linear Search](https://sampleprograms.io/projects/linear-search) in [Tcl](https://sampleprograms.io/languages/tcl) page! Here, you'll find the source code for this program as well as a description of how the program works.
26+
27+
## Current Solution
28+
29+
{% raw %}
30+
31+
```tcl
32+
proc usage {} {
33+
puts stderr {Usage: please provide a list of integers ("1, 4, 5, 11, 12") and the integer to find ("11")}
34+
exit 1
35+
}
36+
37+
proc parseList {s} {
38+
set tokens [split [string trim $s] ","]
39+
if {[llength $tokens] < 1} { usage }
40+
41+
set result {}
42+
43+
set result {}
44+
foreach token $tokens {
45+
set t [string trim $token]
46+
if {$t eq "" || [catch {expr {int($t)}} val]} usage
47+
lappend result $val
48+
}
49+
return $result
50+
}
51+
52+
53+
proc parseInt {s} {
54+
set s [string trim $s]
55+
if {$s eq "" || [catch {expr {int($s)}} val]} {
56+
usage
57+
}
58+
return $val
59+
}
60+
61+
proc linearSearch {nums value} {
62+
expr {[lsearch -integer -exact $nums $value] != -1}
63+
}
64+
65+
if {$argc != 2} { usage }
66+
67+
set numbers [parseList [lindex $argv 0]]
68+
set key [parseInt [lindex $argv 1]]
69+
70+
set found [linearSearch $numbers $key]
71+
puts [expr {$found ? "true" : "false"}]
72+
73+
74+
```
75+
76+
{% endraw %}
77+
78+
Linear Search in [Tcl](https://sampleprograms.io/languages/tcl) was written by:
79+
80+
- Ștefan-Iulian Alecu
81+
82+
If you see anything you'd like to change or update, [please consider contributing](https://github.com/TheRenegadeCoder/sample-programs).
83+
84+
## How to Implement the Solution
85+
86+
No 'How to Implement the Solution' section available. [Please consider contributing](https://github.com/TheRenegadeCoder/sample-programs-website).
87+
88+
## How to Run the Solution
89+
90+
No 'How to Run the Solution' section available. [Please consider contributing](https://github.com/TheRenegadeCoder/sample-programs-website).

0 commit comments

Comments
 (0)