This issue is a discussion for contributors to collaborate in getting ready to be featured in 48in24. Please refer to this forum topic for more info.
We will be featuring Raindrops from Jan 30 onwards and will be featured in:
Ruby
R
Common Lisp
Staff jobs
These are things for Erik/Jeremy to do:
Check/update exercise in Problem Specifications
Create + schedule video
Community jobs
For each track:
Implement Raindrops
Add approaches (and an approaches introduction!) for each idiomatic or interesting/educational approach.
Add video walkthroughs (record yourself solving and digging deeper into the exercise).
Highlight up to 16 different featured exercises (coming soon)
Existing Approaches
You can use these as the basis for approaches on your own tracks. Feel free to copy/paste/reuse/rewrite/etc as you see fit! Maybe ask ChatGPT to translate to your programming language.
A fun Tcl solution, making the variable names do double duty as the strings to concatenate:
proc raindrops {number} {
set Pling 3
set Plang 5
set Plong 7
set drops ""
foreach var [info vars P*] {
if {$number % [set $var] == 0} {
append drops $var
}
}
expr {$drops eq "" ? $number : $drops}
}
The info command has several subcommands. It’s one of the main introspection commands in Tcl.
The set command with two arguments assigns the variable name with the given value. The set command with only one argument returns the value of that variable name. In perl for example, you can do “double-dereferencing” ($$var) to get the value, but Tcl doesn’t do that (without using eval)