run: support reading program from stdin / inline --program for one-shot queries #21

Closed
opened 2026-06-02 17:42:50 +00:00 by navicore · 1 comment
Owner

Summary

patch-prolog run requires at least one .pl file path (files: Vec<PathBuf>, required = true). There is no way to feed a program on stdin or inline, which makes one-shot queries and tooling integration awkward — every ad-hoc test needs a temp file written to disk first.

Use case

Iterating on snippets (REPL-less) and driving the engine from other tools. Today the loop is "write /tmp/x.pl, invoke, repeat per goal." A stdin/inline path removes the temp-file dance.

Suggested options (either or both)

  • stdin via the - convention: patch-prolog run - --goal "..." (or read stdin when no file is given), so programs can be piped:
    echo 'foo(bar).' | patch-prolog run - --goal 'foo(X)'
    
  • inline flag: --program '...' / --eval '...' for a snippet passed on the command line.

Priority

Ergonomics, not correctness — the file interface works and loglings itself always has an exercise file on disk, so this mainly speeds up ad-hoc and tooling use. Lower priority than the parse-error issues.


Raised while building the loglings Prolog exercises against the installed engine.

## Summary `patch-prolog run` requires at least one `.pl` **file path** (`files: Vec<PathBuf>`, `required = true`). There is no way to feed a program on stdin or inline, which makes one-shot queries and tooling integration awkward — every ad-hoc test needs a temp file written to disk first. ## Use case Iterating on snippets (REPL-less) and driving the engine from other tools. Today the loop is "write `/tmp/x.pl`, invoke, repeat per goal." A stdin/inline path removes the temp-file dance. ## Suggested options (either or both) - **stdin via the `-` convention:** `patch-prolog run - --goal "..."` (or read stdin when no file is given), so programs can be piped: ``` echo 'foo(bar).' | patch-prolog run - --goal 'foo(X)' ``` - **inline flag:** `--program '...'` / `--eval '...'` for a snippet passed on the command line. ## Priority Ergonomics, not correctness — the file interface works and loglings itself always has an exercise file on disk, so this mainly speeds up ad-hoc and tooling use. Lower priority than the parse-error issues. --- Raised while building the `loglings` Prolog exercises against the installed engine.
Author
Owner

#26

https://git.navicore.tech/navicore/patch-prolog/pulls/26
Sign in to join this conversation.
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#21
No description provided.