Missing builtins: evaluable \/1 (bitwise complement) and writeq/1 #33

Closed
opened 2026-06-23 17:22:41 +00:00 by navicore · 1 comment
Owner

Summary

Two standard ISO builtins are missing/unimplemented in plgc 0.3.0:

  1. The unary arithmetic functor \/1 (bitwise complement) is not a
    recognized evaluable functor for is/2.
  2. writeq/1 is an undefined procedure.

Version

plgc 0.3.0.

Reproduction

Given any program file p.pl (e.g. p.):

$ plgc run p.pl --query "X is \ 0" --format text
Error: Runtime error: error(type_error(evaluable, /(\, 1)), Unknown arithmetic operator: \/1)

$ plgc run p.pl --query "writeq(foo)" --format text
Error: Runtime error: error(existence_error(procedure, /(writeq, 1)), Undefined procedure: writeq/1)

Expected (ISO)

  • X is \ 0 should evaluate to -1 (bitwise complement of the integer 0);
    \/1 is a standard evaluable functor.
  • writeq/1 is a standard I/O builtin (writes a term with quoting so it reads
    back).

Notes

  • The binary bitwise operators all work correctly: /\ (AND), \/ (OR),
    xor, <<, >>. Only the unary complement \/1 is missing.
  • Filed together as both surfaced while authoring the
    loglings arithmetic-depth
    chapter; split if you'd prefer separate tracking.
## Summary Two standard ISO builtins are missing/unimplemented in `plgc 0.3.0`: 1. The **unary arithmetic functor `\/1`** (bitwise complement) is not a recognized evaluable functor for `is/2`. 2. **`writeq/1`** is an undefined procedure. ## Version `plgc 0.3.0`. ## Reproduction Given any program file `p.pl` (e.g. `p.`): ``` $ plgc run p.pl --query "X is \ 0" --format text Error: Runtime error: error(type_error(evaluable, /(\, 1)), Unknown arithmetic operator: \/1) $ plgc run p.pl --query "writeq(foo)" --format text Error: Runtime error: error(existence_error(procedure, /(writeq, 1)), Undefined procedure: writeq/1) ``` ## Expected (ISO) - `X is \ 0` should evaluate to `-1` (bitwise complement of the integer `0`); `\/1` is a standard evaluable functor. - `writeq/1` is a standard I/O builtin (writes a term with quoting so it reads back). ## Notes - The **binary** bitwise operators all work correctly: `/\` (AND), `\/` (OR), `xor`, `<<`, `>>`. Only the **unary** complement `\/1` is missing. - Filed together as both surfaced while authoring the [loglings](https://git.navicore.tech/navicore/loglings) arithmetic-depth chapter; split if you'd prefer separate tracking.
Author
Owner

#34

https://git.navicore.tech/navicore/patch-prolog/pulls/34
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
navicore/patch-prolog#33
No description provided.