[48in24 Exercise] [01-23] Reverse String

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 Reverse String from Jan 23 onwards and will be featured in:

  • JavaScript
  • Nim
  • C++

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 Reverse String
  • 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.

Track Statuses

Implemented Approaches introduction Num approaches Num video walkthroughs
8th :white_check_mark: :x: - -
ABAP :white_check_mark: :x: - -
AWK :white_check_mark: :x: - -
Ballerina :x: :x: - -
Bash :white_check_mark: :x: - -
C :white_check_mark: :x: - -
C# :white_check_mark: :white_check_mark: 4 -
C++ :white_check_mark: :x: - -
CFML :white_check_mark: :x: - -
Clojure :white_check_mark: :x: - -
COBOL :white_check_mark: :x: - -
CoffeeScript :white_check_mark: :x: - -
Common Lisp :x: :x: - -
Crystal :white_check_mark: :x: - -
D :white_check_mark: :white_check_mark: 1 -
Dart :white_check_mark: :x: - -
Delphi Pascal :white_check_mark: :x: - -
Elixir :x: :x: - -
Elm :white_check_mark: :x: - -
Emacs Lisp :white_check_mark: :x: - -
Erlang :x: :x: - -
F# :white_check_mark: :x: - -
Fortran :white_check_mark: :x: - -
Gleam :white_check_mark: :x: - -
Go :white_check_mark: :x: - -
Groovy :white_check_mark: :x: - -
Haskell :white_check_mark: :x: - -
Java :white_check_mark: :x: - -
JavaScript :white_check_mark: :x: - -
jq :white_check_mark: :x: - -
Julia :white_check_mark: :x: - -
Kotlin :white_check_mark: :x: - -
LFE :x: :x: - -
Lua :white_check_mark: :x: - -
MIPS Assembly :white_check_mark: :x: - -
Nim :white_check_mark: :x: - -
Objective-C :white_check_mark: :x: - -
OCaml :white_check_mark: :x: - -
Perl :x: :x: - -
Pharo :white_check_mark: :x: - -
PHP :white_check_mark: :x: - -
PL/SQL :x: :x: - -
PowerShell :white_check_mark: :x: - -
Prolog :white_check_mark: :x: - -
PureScript :x: :x: - -
Python :white_check_mark: :x: - -
R :white_check_mark: :x: - -
Racket :white_check_mark: :x: - -
Raku :white_check_mark: :x: - -
ReasonML :x: :x: - -
Red :white_check_mark: :x: - -
Ruby :x: :x: - -
Rust :white_check_mark: :x: - 1
Scala :x: :x: - -
Scheme :x: :x: - -
Standard ML :white_check_mark: :x: - -
Swift :x: :x: - -
Tcl :x: :x: - -
TypeScript :white_check_mark: :x: - -
Unison :white_check_mark: :x: - -
V :white_check_mark: :x: - -
Vim script :white_check_mark: :x: - -
Visual Basic :white_check_mark: :x: - -
WebAssembly :white_check_mark: :x: - -
Wren :white_check_mark: :x: - -
x86-64 Assembly :white_check_mark: :x: - -
Zig :white_check_mark: :x: - -

Python approach in process.

Might also explore the “extra credit” of reversing unicode strings with diacritical marks that need to stay in order. It’s (sadly) non-trivial in core Python.

4 Likes

I’ll work on porting the exercise for CoffeeScript and Common Lisp. I’ll check with the Elm maintainers about porting it for their track as well.

2 Likes

I have finished approaches for Crystal: [Reverse-String]: Add approaches by meatball133 · Pull Request #573 · exercism/crystal (github.com)

I will also implement it for Swift a bit later.

3 Likes

That is very detail!
Is the performance part also needed or you just added it because you want to?

Performance articles are optional, but I think they’re a really really nice addition. Especially for languages where you can highlight speed vs memory tradeoffs.

I’m not sure where to ask but i suppose it is related to 48in24 anyway.
Is the general plan for this year is all 48 featured exercises will be implemented for every track, and they must all have approaches and video?
Or just the implementation part is the core, and other aspect are optional, nice to have but not crucial.

It would be nice if they are implemented in every track. But I don’t think that is a requirement. It would be nice to have approaches and videos, but I suspect that isn’t going to happen for a decent number.

I would have to defer to @iHiD and @ErikSchierboom for all of the details, but my understanding is that the goal is to get as many of the featured exercises implemented across all tracks as possible, and have as many approaches articles as possible completed for them.

There will be videos for each featured exercise where iHiD and Erik discuss strategies and programming language choices, but the hope is that there will also be video walkthroughs contributed by the community.

But its not “do or die” – more an inspiration or strong encouragement to get some content filled in, and some new contributors on board.

Thanks for the reply!
That make a lot more sense I suppose, cuz I look at the date and it seem like a short time to do all of that for all of the tracks.
Also, would it be possible to get the full list of the 48 exercises soon, or it is not possible because they need to be consider based on many factors so it will be a gradual thing like last year?

See Which exercises for #48in24? - #12 by ErikSchierboom

Note: Let’s try and keep these threads specific to the actual exercise in question and have general discussions on dedicated threads. Thanks! :slight_smile:

PRs made. I’ll take a look at porting the exercises for Ballerina, OCaml, and ReasonML and then write approaches and mentoring notes for Racket and Vim script.

1 Like

Just FYI in case somebody was planning to help by adding reverse-string to Elixir: don’t. @jiegillet and I chose not to implement it on purpose. See https://github.com/exercism/elixir/blob/8d74999e643302cd02057e32b51168f6d60e592c/config.json#L3008-L3015

If nobody else is already working on it, I’d like to do the approaches for the Clojure track.

1 Like

I can look into adding the reverse-string exercise to the Haskell track as I see that is missing currently.

1 Like

Awesome. Thanks!

1 Like

Discuss: null-terminated strings

C and assembly languages work with null-terminated strings. We can discuss:

  • This can be good for performance, as no additional length field needs to be stored in memory, but similarly it can be bad too as figuring out the length is O(N)
  • This is bad for memory safety, as it is easy to make a mistake and go beyond the length of a string

Discuss: in-place mutation vs copy

In some languages, strings a mutable, in other they’re not. The latter would require a copy to be made, whereas the former doesn’t.

We can discuss:

  • Why make strings immutable at all? (safety, ability for inlining)
  • Is there a performance difference (well yes, as copy involves allocating new memory)
  • Specialized string builders

This can also be bad for performance is what we’re performing involves figuring out the string length :grin:

1 Like

Discuss: bytes vs characters

Some languages treat strings as a sequence of characters (or make it appear as if they do), others do not, and they usually treat a string as a sequence (or array) of bytes.

We can discuss:

  • The trade-off. Why not always treat them as chars?
  • ASCII vs Unicode, why the former is more limited (only 128 chars for regular ASCII, 255 for extended ASCII)
  • UTF-8 encodes unicode, but uses variable bytes encoding (ASCII chars are one byte, but other character points could use up to four bytes)
  • Difference between rune (single unicode code point) vs graphemes (aka grapheme cluster, which is what you see or print on screen, can be multiple code points)
1 Like