Skip to content

fix: collect expression symbols with symbol? - #60

Open
felipeofdev-ai wants to merge 1 commit into
nubank:mainfrom
felipeofdev-ai:fix/59-expression-symbols
Open

fix: collect expression symbols with symbol?#60
felipeofdev-ai wants to merge 1 commit into
nubank:mainfrom
felipeofdev-ai:fix/59-expression-symbols

Conversation

@felipeofdev-ai

Copy link
Copy Markdown

Summary

  • Change expression-symbols to filter with symbol? instead of (complement seqable?).
  • Document why, and add regression tests that numbers/keywords in >leaf expressions do not become inputs.

Why

?-input discovery only needs symbols. Filtering non-seqable leaves also kept numbers, keywords, and strings in the candidate set until a later string prefix check — symbol? answers issue #59 directly and makes the intent obvious.

Fixes #59

Test plan

  • lein test nodely.syntax-test (0 failures)
  • Full suite / CI

— Felipe Fernandes · Systems & Agentic AI Engineer
https://github.com/felipeofdev-ai · https://felipeofdev-ai.github.io/

Made with Cursor

Copilot AI review requested due to automatic review settings August 3, 2026 22:29
Filter tree leaves with symbol? instead of (complement seqable?) so
non-symbol atoms are never treated as ?-inputs.

Fixes nubank#59

Signed-off-by: Felipe Fernandes <felipe.of.dev@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refines nodely.syntax’s ?-input discovery by having expression-symbols collect only symbols, making intent clearer and avoiding non-symbol atoms being considered during traversal.

Changes:

  • Update expression-symbols to filter with symbol? instead of (complement seqable?).
  • Add a docstring explaining why symbol? is used.
  • Add tests around >leaf input discovery to prevent non-symbol atoms from being treated as inputs.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/nodely/syntax.clj Switches leaf collection to symbol? and documents the rationale for input discovery.
test/nodely/syntax_test.clj Adds coverage around >leaf input detection for non-symbol atoms in expressions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +225 to +230
(testing "numbers and keywords in an expression do not become inputs"
(is (match? #::data{:type :leaf :inputs #{:x} :fn ifn?}
(>leaf (+ ?x 1 :not-an-input)))))
(testing "only `?`-prefixed symbols become inputs"
(is (match? #::data{:type :leaf :inputs #{:y} :fn ifn?}
(>leaf (str ?y "suffix"))))))
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.

Bug? expression-symbols

2 participants