Skip to content

Add approaches (Dig Deeper) for pangram - #1018

Merged
rabestro merged 3 commits into
mainfrom
pangram-approaches
Nov 22, 2026
Merged

rabestro merged 3 commits into
mainfrom
pangram-approaches

Conversation

@rabestro

Copy link
Copy Markdown
Member

Closes #983

pangram's "Dig Deeper" tab is empty on the Scala track. This adds an introduction and four approaches:

Slug Idea
set-subset alphabet.subsetOf(input.toLowerCase.toSet) (the current example)
forall ('a' to 'z').forall(lowercase.contains)
distinct-count keep a to z, then .distinct.length == 26
bit-field foldLeft that sets bit c - 'a', compared with (1 << 26) - 1

The introduction compares them by readability and by how often the sentence is walked: forall can scan it up to 26 times, the bit field visits it once and allocates nothing.

distinct-count has a caution block that is not in the issue: isLetter is also true for letters such as é, so using it as the filter would take 25 letters plus an é for a pangram.

Checks

  • Every full solution in the markdown passes pangram's test suite with all 10 tests enabled.
  • The code is unchanged by scalafmt 3.8.2 with the track's .scalafmt.conf.
  • The Scaladoc links point at https://www.scala-lang.org/api/current/... and resolve.
  • bin/configlet lint passes.

🤖 Generated with Claude Code

Four approaches: Set with subsetOf, forall with contains, filter with
distinct, and a bit field built with foldLeft.

Closes #983

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Hello 👋 Thanks for your PR.

This repo does not currently have dedicated maintainers. Our cross-track maintainers team will attempt to review and merge your PR, but it will likely take longer for your PR to be reviewed.

If you enjoy contributing to Exercism and have a track-record of doing so successfully, you might like to become an Exercism maintainer for this track.

Please feel free to ask any questions, or chat to us about anything to do with this PR or the reviewing process on the Exercism forum.

(cc @exercism/cross-track-maintainers)

@rabestro rabestro self-assigned this Nov 14, 2026
@rabestro
rabestro marked this pull request as draft November 14, 2026 21:24
@rabestro
rabestro marked this pull request as ready for review November 22, 2026 16:07
@rabestro
rabestro requested review from a team, IsaacG and glennj November 22, 2026 16:08
@rabestro
rabestro merged commit 58f6749 into main Nov 22, 2026
8 checks passed
@rabestro
rabestro deleted the pangram-approaches branch November 22, 2026 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add approaches (Dig Deeper) for pangram

2 participants