Skip to content

feat: add has builtin — membership test for lists and text#52

Closed
danieljohnmorris wants to merge 1 commit into
mainfrom
feature/builtin-has
Closed

feat: add has builtin — membership test for lists and text#52
danieljohnmorris wants to merge 1 commit into
mainfrom
feature/builtin-has

Conversation

@danieljohnmorris
Copy link
Copy Markdown
Collaborator

Summary

  • Adds has builtin that checks if a collection contains a value
  • Works with lists (element membership via equality) and text (substring search)
  • Implemented across all three execution paths: verifier, tree-walking interpreter, and VM
  • New opcode OP_HAS (48) for VM with ABC encoding: R[A] = has(R[B], R[C])

Test plan

  • Verifier: valid list arg, valid text arg, wrong type arg 1 (3 tests)
  • Interpreter: list contains, list not contains, text contains, text not contains (4 tests)
  • VM: list contains, list not contains, text contains, compiles to OP_HAS (4 tests)
  • All 862 tests pass
  • Clippy clean (no new warnings)

@danieljohnmorris
Copy link
Copy Markdown
Collaborator Author

Superseded by #56 which combines all builtins + ternary with correct opcode numbering.

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