Command line argument arguments in Prolog?

Are there any I wrote a program that solves sudoku puzzles, and it launches 3 steps.

> prolog
> consult(sudoku).
> solve(puzzle).

I'm looking for a way to do something like

> prolog puzzle

and get it over with. Is there a way to do this in Prolog? Or I need to write some helper program in C or some other language to use, for example

> ./solve puzzle

Any help would be greatly appreciated. Still new to Prolog, and you have trouble finding good documentation.

+3
source share
2 answers

It depends on the Prolog system used. Most Prolog systems have a start command line, where you can provide the initial text of the Prolog that you should familiarize yourself with, and the initial goal of the Prolog.

, :

SWI-Prolog:

> swipl -t ['sudoku.p'],puzzle

GNU Prolog:

> gprolog --entry-goal ['sudoku.p'],puzzle,halt

Jekejeke Prolog:

> java -jar interpreter.jar -t ['sudoku.p'],puzzle

+3

-g, Prolog . , . , -t, .

. .

+2

All Articles