Skip to content

Conversation

@akollegger
Copy link
Contributor

This pull request introduces comprehensive support for records (immutable key-value structures) in Pattern Lisp, replacing the previous map syntax with a gram-compatible, comma-separated inline record notation. The changes update documentation, code, and examples to reflect this new record system, including syntax, operations, and compatibility with gram notation.

Documentation and Syntax Updates:

  • Added a complete documentation page for records, detailing syntax, operations, quasiquotation, and gram compatibility (docs/pattern-lisp-records.md).
  • Updated the syntax conventions document to replace maps with records, describing the new record notation, operations, and rationale for the change (docs/pattern-lisp-syntax-conventions.md). [1] [2] [3] [4]

Codebase and Example Enhancements:

  • Extended the value formatting logic in app/Main.hs to support new record types (VMap) and related value types, ensuring correct display and type reporting for records and their contents.
  • Added an example file and documentation for record usage, demonstrating creation, manipulation, and advanced features in examples/README.md.

Project and Feature Plan Updates:

  • Updated feature plans and specification rules to reflect the addition of records, replacing maps and documenting the new implementation details (.cursor/rules/specify-rules.mdc). [1] [2]
  • Updated the main project README to mention records as a core data structure.

Other Improvements:

  • Updated boolean value display in examples for consistency with the new record system (examples/pattern-predicates.plisp). [1] [2]

@cursor
Copy link

cursor bot commented Jan 21, 2026

You have run out of free Bugbot PR reviews for this billing cycle. This will reset on February 15.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Copy link
Contributor

Copilot AI left a comment

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 migrates Pattern Lisp’s core data/value model to use gram-compatible record and value types, replaces the old map syntax with inline record notation, and wires records through the parser, evaluator, codec, REPL display, tests, and docs. It also introduces quasiquotation support for records and validates compatibility with gram serialization.

Changes:

  • Refactors Value and Expr (e.g., VNumberVInteger, VListVArray, MapLiteralRecordLiteral, adds Unquote/UnquoteSplice) and updates evaluation, primitives, and codec logic to operate on gram-style records (VMap (Map String Value) with String keys).
  • Extends the parser with array and record literals, gram-like booleans (true/false), and record quasiquotation support; adds extensive tests for records, record operations, quasiquotation, and gram compatibility.
  • Updates the REPL and CLI formatting, examples, and documentation to present and explain records as the core key-value data structure, including a new records example file and a detailed spec/plan for the feature.

Reviewed changes

Copilot reviewed 37 out of 37 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/Spec.hs Wires new PatternLisp.RecordGramCompatibilitySpec into the test suite.
test/REPLSpec.hs Aligns REPL type formatting and output expectations with VInteger, VBoolean, and VArray.
test/Properties.hs Updates property generators and helpers to use VInteger, VBoolean, VArray, and records keyed by String instead of MapKey.
test/PatternLisp/RecordGramCompatibilitySpec.hs Adds comprehensive tests validating record parsing/eval against gram serialization and quasiquotation edge cases.
test/PatternLisp/PrimitivesSpec.hs Rewrites numeric, boolean, set, and map tests for the new Value constructors and adds a large suite of record operation and performance tests.
test/PatternLisp/PatternSpec.hs Adjusts pattern-related tests to the new string and array representations (VString String, VArray).
test/PatternLisp/ParserSpec.hs Replaces map tests with record tests, switches booleans to true/false, and validates record-specific parse errors and splice parsing.
test/PatternLisp/GramSpec.hs Updates Gram serialization tests to the new Value constructors (VInteger, VBoolean, VArray).
test/PatternLisp/GramSerializationSpec.hs Refactors round-trip tests to use the new Value API and adds coverage for closures/environments under the new types.
test/PatternLisp/EvalSpec.hs Aligns core language, map/record, keyword, and pattern tests with the new value and record semantics, including record quasiquotation and edge cases.
test/PatternLisp/CodecSpec.hs Updates codec round-trip tests to the gram-style value constructors and string representation, including maps-as-records.
test/IntegrationSpec.hs Adjusts integration tests to expect VInteger results for arithmetic and conditionals.
test/ExamplesSpec.hs Updates example expectations from VList/VNumber to VArray/VInteger.
src/PatternLisp/Syntax.hs Redefines Atom and Value around gram types, removes MapKey/KeywordKey, introduces RecordLiteral, array literals, and a richer Primitive set for records, and wires name lookup for new primitives.
src/PatternLisp/Primitives.hs Registers the new record-related primitives and updates the initial environment accordingly.
src/PatternLisp/PatternPrimitives.hs Adjusts pattern utilities to use VArray instead of VList, and updates valueToPatternSubject for the new list representation.
src/PatternLisp/Parser.hs Replaces map parsing with a Megaparsec-based record parser, adds array parsing, gram-like booleans, and a quasiquote parser emitting Unquote/UnquoteSplice for record contents.
src/PatternLisp/Eval.hs Reworks evaluation for the new Value/Expr constructors, adds record literal evaluation (including unquote/splice handling), and defines all record primitives (record?, get, has?, keys, values, record->alist, alist->record, assoc, dissoc, merge, map, filter).
src/PatternLisp/Codec.hs Aligns value<->subject and expression<->pattern conversions with gram value types, simplifies map/record handling to String keys, and extends support for additional gram value constructors.
specs/007-inline-record-notation/* Introduces a full spec, plan, data model, research, schema analysis, contracts, and checklists that define and justify the record refactoring and its gram alignment.
pattern-lisp.cabal Adds the new record/gram compatibility spec and the gram library dependency to the test suite.
examples/records.plisp New example file showing record creation, operations, quasiquotation, and realistic record use cases.
examples/pattern-predicates.plisp Updates comments and examples to use true/false rather than #t/#f.
examples/README.md Documents the new records.plisp example and summarizes its coverage.
docs/pattern-lisp-syntax-conventions.md Replaces the “Maps” section with a detailed “Records” section, updating syntax/semantics to comma-separated gram-style records and record operations.
app/Main.hs Updates CLI value rendering and type display to the new Value constructors and adds sensible formatting for records, sets, and other gram types.
README.md Mentions records (with arrays and sets) as core data structures in Pattern Lisp.

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

@akollegger akollegger merged commit 66d2062 into main Jan 21, 2026
7 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.

2 participants