⏺ All tests pass (8 Seq, 449 Lisp, 6 LSP). #57
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
seq-lisp-2-backport
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
navicore/seq-lisp!57
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "strings"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary of completed work:
Added 8 new Lisp string operations as wrappers around Seq's string builtins:
┌─────────────────────┬──────────────────────────┬────────────────────────────────────────────┐
│ Function │ Description │ Example │
├─────────────────────┼──────────────────────────┼────────────────────────────────────────────┤
│ string-split │ Split by delimiter │ (string-split "a,b,c" ",") → ("a" "b" "c") │
├─────────────────────┼──────────────────────────┼────────────────────────────────────────────┤
│ string-trim │ Remove whitespace │ (string-trim " hi ") → "hi" │
├─────────────────────┼──────────────────────────┼────────────────────────────────────────────┤
│ string-upcase │ Uppercase │ (string-upcase "hello") → "HELLO" │
├─────────────────────┼──────────────────────────┼────────────────────────────────────────────┤
│ string-downcase │ Lowercase │ (string-downcase "HELLO") → "hello" │
├─────────────────────┼──────────────────────────┼────────────────────────────────────────────┤
│ string-contains? │ Check substring │ (string-contains? "hello" "ell") → #t │
├─────────────────────┼──────────────────────────┼────────────────────────────────────────────┤
│ string-starts-with? │ Check prefix │ (string-starts-with? "hello" "he") → #t │
├─────────────────────┼──────────────────────────┼────────────────────────────────────────────┤
│ string-find │ Find index │ (string-find "hello" "ll") → 2 │
├─────────────────────┼──────────────────────────┼────────────────────────────────────────────┤
│ string-chomp │ Remove trailing newlines │ (string-chomp "hi\n") → "hi" │
└─────────────────────┴──────────────────────────┴────────────────────────────────────────────┘
These join the existing string-length, substring, and string-append to provide a complete string manipulation toolkit. The roadmap has been updated to
reflect this completion.
PR Review: String Operations Implementation
Summary
This PR adds 8 new string manipulation functions as wrappers around Seq's string builtins. All tests pass (8 Seq, 449 Lisp, 6 LSP), and the implementation follows the established patterns in the codebase.
Code Quality ✓
Strengths:
string-length,substring,string-append)check-arityeval-err?checksCode style observations:
# Stack: Acc SeqList Idx)?for predicatesPotential Issues & Considerations
1. Missing Test Coverage ⚠️
Critical: No tests found for any of the 8 new functions in
tests/lisp/core/strings.slisp.The existing test file only covers:
string-lengthsubstringstring-appendRecommendation: Add comprehensive tests for:
2. Edge Case Handling
Empty string delimiter in
string-split: src/eval.seq:2099The Seq
string.splitbehavior with empty delimiter should be documented or tested. Does it split into individual characters or error?Unicode handling:
All functions rely on Seq's built-in string methods. Assuming Seq handles Unicode correctly, but worth verifying for:
string-upcase/string-downcasewith non-ASCII charactersstring-lengthwith multi-byte characters3. Documentation
Function signatures in comments: The implementation has good function headers but could benefit from examples in the comments:
Performance Considerations
✓ No concerns: All functions are thin wrappers around Seq's efficient built-in string operations. The stack-based evaluation is consistent with the rest of the codebase.
The
string-list-to-sexpr-listhelper at src/eval.seq:2109-2123 uses recursion efficiently and includes alist-reverseoperation which is appropriate for building lists in stack order.Security Concerns
✓ No issues identified:
Roadmap Update ✓
The ROADMAP.md update is accurate and properly marks the string operations as completed. The table in the PR description provides clear documentation.
Overall Assessment
Score: 8/10
This is solid, production-ready code that follows established patterns. The only significant gap is test coverage for the new functions.
Recommendation: Merge after adding tests for the 8 new functions. The implementation is sound, but tests are essential to prevent regressions and document expected behavior.
Nice work on:
Action items:
tests/lisp/core/strings.slispfor all 8 new functionsOnce tests are added, this PR is ready to merge! 🚀
PR Review: String Operations Implementation
Overview
This PR adds 8 new string manipulation functions to SeqLisp, wrapping Seq's built-in string operations. The implementation is well-structured with comprehensive test coverage (40 new tests).
✅ Strengths
Code Quality
eval.seqfor:EvalResultunionTest Coverage
The test suite is excellent with 40 well-designed tests covering:
Implementation Details
#t/#fsymbols for predicate functions🔍 Observations
Minor Naming Inconsistency (Non-blocking)
Line 2228 in
src/eval.seq:Should be
eval-string-starts-with**-with**-envto match the naming pattern of all other functions (e.g.,eval-string-contains-with-envon line 2189).Impact: Low - the function is correctly called in the dispatch (line 963 uses the correct name
eval-string-starts-with-env), so this is purely a naming consistency issue. The code works correctly as-is.Design Considerations
string-find return value: Returns
-1for not found (C-style). This is reasonable and consistent with many languages, though some Lisps usenil. The current choice is fine and well-documented in tests.string-chomp behavior: The test on line 117 shows
(string-chomp "hello\n\n")returns"hello\n"(removes only the last newline). This matches Ruby'schompsemantics, which is intentional and correct.Stack operations: The implementation uses manual stack manipulation (
rot,swap,dup,nip, etc.) which is idiomatic for Seq. The inline comments help track stack states.🎯 Performance
No performance concerns:
string-splituses tail recursion🔒 Security
No security concerns:
📊 Testing
Excellent coverage across all dimensions:
Edge cases well-covered: empty strings, no matches, boundary conditions, multi-character delimiters.
✅ Recommendation
APPROVE - This is high-quality work that:
The minor naming inconsistency noted above is cosmetic and doesn't affect functionality. The PR can be merged as-is, or the naming can be corrected in a follow-up commit if desired.
📝 Optional Follow-up
If you want to address the naming consistency:
But again, this is purely cosmetic and non-blocking.
Great work! 🎉