[48in24 Exercise] [04-23] Pangram

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 Pangram from Apr 23 onwards.

Staff jobs

These are things for Erik/Jeremy to do:

  • :ballot_box_with_check: Check/update exercise in Problem Specifications
  • :ballot_box_with_check: Create + schedule video

Community jobs

For each track:

  • Implement Pangram
  • 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

You can see an overview of which tracks have implemented the exercise at the #48in24 implementation status page.

I’ll port for Red and SQLite.

I’ve currently gathered the following solutions to feature:

  1. Kotlin: check if input string contains all letters
    Loop over the letters in the alphabet and check if they’re all in the input string

  2. jq: functional pipeline, sort characters and use contains
    Convert the input to a sorted list of lowercase characters and check if it contains the alphabet

  3. Ruby: count unique lowercase letters in method chain
    Count the unique number of lowercase letters

  4. Python: check if all letters are in lowercase letters string
    Use higher-order function to check if all letters in lowercase string (no short-circuiting)

  5. Julia: alphabet is subset
    Use subset logic where entire (lowercase) alphabet is subset of (lowercase) string

  6. Pharo: set difference with alphabet
    Check if difference of the alphabet with the input is empty

  7. Nim: keep track of seen letters in set
    Store seen letters in a set and check if the set has the right size. With short-circuiting

  8. Rust: bit field
    As there are 26 letters, we can track their presence using a 32-bit integer

  9. Zig: bit set
    As there are 26 letters, we can track their presence using a bit set

If anyone has more suggestions, do let us know!

Ranges + Sets + coercive (unicode) operators => short and still readable Solution - but basically “Julia + Strongly Typed Function Signature”

Doing the whole thing with just one regex: Steffan153's solution for Pangram in Elixir on Exercism
(maybe too complicated lol)

Or another way to do it with regex (this one doesn’t require PCRE): Steffan153's solution for Pangram in JavaScript on Exercism

Better late than never :slight_smile:

1 Like
1 Like

A micro-optimization to the Python: check if all letters are in lowercase letters string approach: iterate over the alphabet in increasing frequency of usage, with the aim of failing faster: https://exercism.org/tracks/kotlin/exercises/pangram/solutions/glennj

2 Likes

That is a cool micro optimization