Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: optimized SolutionHandler and boolean predication support, with… #4

Merged
merged 3 commits into from
Nov 21, 2024

Conversation

pluveto
Copy link
Owner

@pluveto pluveto commented Nov 21, 2024

This PR refactors the rulog_vm module to improve flexibility, modularity, and testability. Key changes include a more idiomatic Environment struct, the introduction of a SolutionHandler trait for query result processing, and expanded test coverage.

Key Changes

  1. Environment Refactor

    • Replaced new() with Default.
    • Added an extend method to facilitate environment extension.
  2. SolutionHandler Trait

    • Added the SolutionHandler trait for custom solution handling during query evaluation.
    • Introduced PrintSolutionHandler as a default solution handler.
  3. Interpreter Changes

    • Replaced the on_solution callback with SolutionHandler.
    • Updated eval to accept a SolutionHandler for query result processing.
  4. Improved QuerySolver

    • Enhanced query resolution logic, including better handling of direct matches between goal and clause.

Breaking Changes

  • The on_solution callback in Interpreter is removed. Custom solution handling is now done via the SolutionHandler trait.

Tests

  • Added tests for unification with nested structures, lists, and recursive terms.
  • Enhanced interpreter tests to verify custom solution handling.

@pluveto pluveto merged commit 476ed8e into master Nov 21, 2024
1 check 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.

1 participant