Skip to content

Qualify predicates chapter's index, sort-order, and function-availability claims - #49

Merged
thiagooak merged 1 commit into
mainfrom
worktree-agent-aa9dcd03b4c47f35c
Sep 21, 2026
Merged

thiagooak merged 1 commit into
mainfrom
worktree-agent-aa9dcd03b4c47f35c

Conversation

@thiagooak

Copy link
Copy Markdown
Owner

Closes #26

What changed

  • The claim "Datomic answers them with an index" for range predicates now notes that on Datomic Pro this only applies to attributes marked :db/index true or :db/unique; the site's schema doesn't set either on :pokemon/name/the stat attributes, but Datomic Cloud/Local (what this site runs on) index every attribute regardless.
  • "Strings sort in dictionary order" is replaced with "sort by character code, not dictionary order", and the text now explains that the >= "S" / < "T" trick only equals starts-with? "S" because every Pokemon name in this dataset happens to be capitalized.
  • "In a real Datomic app, any Clojure function is available" is expanded to say it must be a pure clojure.core function (except eval), or a Java/Clojure function on the classpath of the process running the query, and that with the Client API that process is the server, not the caller's application.

Verification

  • Confirmed via the schema in resources/pokemon.edn that neither :pokemon/name nor the stat attributes have :db/index or :db/unique.
  • Ran real queries through app.core/run-q against the pokemon dataset:
    • starts-with? ?name "S" → 14 rows
    • >= ?name "S" and < ?name "T" → 14 rows (same set)
    • >= ?name "a" (lowercase) → 0 rows, confirming case-sensitive code-unit ordering
  • clojure -X:test: 32 tests, 493 assertions, 0 failures.

Only resources/chapters/predicates.edn is touched; the dead-anchor link fix in this same file is left alone since it's scoped to issue #31.

🤖 Generated with Claude Code

…lity claims

The AVET-index speedup for range predicates only applies without qualification
on Datomic Cloud/Local; on Pro the attribute needs :db/index or :db/unique.
String comparison is by character code, not dictionary order, which is why the
>= "S" / < "T" trick only matches starts-with? because every name here is
capitalized. Also spell out which functions are actually available to a
predicate and why the Client API changes that.

Closes #26

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@thiagooak
thiagooak merged commit 752991d into main Sep 21, 2026
2 checks passed
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.

COR-10: Predicates: index claim, "dictionary order", "any Clojure function"

1 participant