Skip to content

Add binding for function rename for class term and rule in apyds and atsds - #31

Merged
hzhangxyz merged 3 commits into
mainfrom
copilot/add-binding-for-rename-function
Nov 25, 2025
Merged

Add binding for function rename for class term and rule in apyds and atsds#31
hzhangxyz merged 3 commits into
mainfrom
copilot/add-binding-for-rename-function

Conversation

Copilot AI commented Nov 25, 2025

Copy link
Copy Markdown
Contributor

Adds rename method bindings to allow adding prefix/suffix to all variable names in terms and rules.

Changes

C++ Bindings

  • apyds/ds.cc: Added term_rename and rule_rename wrapper functions with pybind11 registration
  • atsds/ds.cc: Added equivalent functions with emscripten/embind registration

Python Wrappers

  • apyds/term_t.py: Added Term.rename() method
  • apyds/rule_t.py: Added Rule.rename() method

TypeScript Wrappers

  • atsds/tsds.mts: Added term_t.rename() and rule_t.rename() methods

Tests

  • Added tests for both Python and TypeScript covering basic rename, empty prefix/suffix, lists, premises, and invalid input cases

Usage

import apyds

# Rename variables with prefix and suffix
term = apyds.Term("`x")
ps = apyds.Term("((pre_) (_suf))")
print(term.rename(ps))  # `pre_x_suf

# Works on rules with premises
rule = apyds.Rule("`p\n`q\n----------\n`r\n")
print(rule.rename(ps))  # `pre_p_suf\n`pre_q_suf\n----------\n`pre_r_suf\n
const term = new term_t("`x");
const ps = new term_t("((pre_) (_suf))");
console.log(term.rename(ps).toString()); // `pre_x_suf
Original prompt

This section details on the original issue you should resolve

<issue_title>Add binding for function rename for class term and rule in apyds and atsds.</issue_title>
<issue_description>See apyds/ds.cc apyds/term.py apyds/rule.py for apyds
See atsds/ds.cc atsds/tsds.mts for atsds</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits November 25, 2025 12:05
Co-authored-by: hzhangxyz <11623447+hzhangxyz@users.noreply.github.com>
Co-authored-by: hzhangxyz <11623447+hzhangxyz@users.noreply.github.com>
Copilot AI changed the title [WIP] Add binding for function rename in class term and rule Add binding for function rename for class term and rule in apyds and atsds Nov 25, 2025
Copilot AI requested a review from hzhangxyz November 25, 2025 12:11
@hzhangxyz
hzhangxyz marked this pull request as ready for review November 25, 2025 12:12
@hzhangxyz
hzhangxyz merged commit ae1f4b6 into main Nov 25, 2025
77 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.

Add binding for function rename for class term and rule in apyds and atsds.

2 participants