fix: Align PTC-Lisp semantics with Clojure specification (#245)#248
fix: Align PTC-Lisp semantics with Clojure specification (#245)#248andreasronge merged 2 commits intomainfrom
Conversation
- Fix `or` operator to track last evaluated value (not just truthy values) - Fix `some` predicate to return result from predicate application - Fix subtraction operator to use correct left-associative reduce order - Move unary minus handler before general variadic handler (clause ordering) These fixes align PTC-Lisp behavior with Clojure semantics: - (or false nil) now returns nil (last value) instead of nil (identity) - (some nil? [1 nil 3]) now returns true (predicate result) not just true/false - (- 10 3 2 1) now correctly computes to 4 (10-3-2-1) instead of -8 - (- 10) now correctly returns -10 instead of 10 Closes #245 🤖 Generated with Claude Code Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
PR Review: fix: Align PTC-Lisp semantics with Clojure specification (#245)SummaryThis PR implements three targeted semantic fixes to align PTC-Lisp with Clojure behavior: What's Good
Issues (Must Fix)
Suggestions (Optional)None - the implementation is clean and focused. SecurityNo security concerns - this is a semantic fix to internal interpreter logic with no external attack surface. DocumentationThe specification at VerdictRequest Changes - The code changes are correct and well-tested, but the specification documentation needs a one-line update to reflect the new |
|
@claude please fix these issues from PR review: Issue 1: Update
|
Auto-Triage SummaryDecisions Made
Status
ReasoningThe documentation fix is in-scope for this PR since the PR explicitly changed |
The implementation of `some` now returns the first truthy result of the predicate instead of a boolean, matching Clojure semantics. Update the specification documentation to reflect this behavior. Resolves PR #248 review feedback.
Fix SummaryIssue 1: Update
|
PR Review: fix: Align PTC-Lisp semantics with Clojure specification (#245)SummaryThis PR correctly implements three semantic fixes to align PTC-Lisp with Clojure specification: What's Good
Issues (Must Fix)None - the previous review cycle identified that the Suggestions (Optional)None - the implementation is focused and minimal. SecurityNo security concerns - these are semantic fixes to internal interpreter logic with no external attack surface. Documentation
VerdictApprove - The implementation correctly addresses all three semantic issues from #245 with comprehensive tests and proper documentation updates. Ready for merge. |
Auto-Triage SummaryDecisions Made
Status
ReasoningThe latest review verdict is Approve with no issues identified. The previous review cycle's documentation issue was already fixed (updating Label |
Summary
Implemented three targeted semantic fixes to align PTC-Lisp with Clojure specification:
oroperator: Now tracks and returns the last evaluated value (whether truthy or falsy) instead of only returning truthy values or nilsomepredicate: Returns the result of applying the predicate to the first matching element (truthy result) instead of just a booleanTest Plan
Added comprehensive tests for all three fixes:
ornow correctly returns last falsy value when all are falsysomereturns first truthy predicate result (e.g., true for(some nil? [1 nil 3]))(- 10)→-10(- 10 3)→7(- 10 3 2 1)→4(not-8)All existing tests pass (1126 tests, 0 failures).
Closes #245