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

efficient renamed copy for partials #268

Merged
merged 1 commit into from
Nov 30, 2022
Merged

efficient renamed copy for partials #268

merged 1 commit into from
Nov 30, 2022

Conversation

ichiban
Copy link
Owner

@ichiban ichiban commented Nov 30, 2022

Renamed copy of engine.partial was a bit tricky when it's a cyclic term and it used to fallback to *engine.compound.

This PR modifies engine.partial a bit so that we can get an efficient renamed copy of *engine.partial.

$ $(go env GOPATH)/bin/1pl inriasuite.pl
Top level for ichiban/prolog v0.14.0
This is for testing purposes only!
See https://github.com/ichiban/prolog for more details.
Type Ctrl-C or 'halt.' to exit.
?- copy_term([a, b|X], C), go_string(C, S).
X = _409,
C = [a,b|_420],
S = '&engine.compound{functor:".", args:[]engine.Term{"a", &engine.compound{functor:".", args:[]engine.Term{"b", 420}}}}'
$ go run cmd/1pl/main.go cmd/1pl/interpreter.go 
Top level for ichiban/prolog 
This is for testing purposes only!
See https://github.com/ichiban/prolog for more details.
Type Ctrl-C or 'halt.' to exit.
?- copy_term([a, b|X], C), go_string(C, S).
X = _270,
C = [a,b|_281],
S = 'engine.partial{Compound:engine.list{"a", "b"}, tail:281}'

@codecov
Copy link

codecov bot commented Nov 30, 2022

Codecov Report

Base: 99.06% // Head: 99.06% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (550c0c3) compared to base (16f5086).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #268   +/-   ##
=======================================
  Coverage   99.06%   99.06%           
=======================================
  Files          22       22           
  Lines        7148     7162   +14     
=======================================
+ Hits         7081     7095   +14     
  Misses         50       50           
  Partials       17       17           
Impacted Files Coverage Δ
engine/builtin.go 99.09% <100.00%> (+<0.01%) ⬆️
engine/clause.go 98.40% <100.00%> (ø)
engine/compound.go 100.00% <100.00%> (ø)
engine/env.go 98.93% <100.00%> (+0.01%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@ichiban ichiban marked this pull request as ready for review November 30, 2022 11:36
@ichiban ichiban merged commit 8dff549 into main Nov 30, 2022
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