Prolog中的命令行参数向量? [英] Command line argument vectors in Prolog?

查看:28
本文介绍了Prolog中的命令行参数向量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

它们存在吗?我编写了一个解决数独谜题的程序,运行需要 3 个步骤.

Do they exist? I have written a program that solves sudoku puzzles, and it takes 3 steps to run.

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

我正在寻找一种方法来做类似的事情

I'm looking for a way to do something like

> prolog puzzle

并完成它.有没有办法在序言中做到这一点?或者我是否必须用 C 或其他语言编写一些帮助程序来使用

and be done with it. Is there a way to do this IN Prolog? Or will I have to write some helper program in C or some other language to use like

> ./solve puzzle

任何帮助将不胜感激.仍然是 Prolog 的新手,并且很难找到好的文档.

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

推荐答案

这取决于您使用的 Prolog 系统.大多数 Prolog 系统都有一个命令行从这里开始,人们可以提供要查阅的初始 Prolog 文本和要运行的初始 Prolog 目标.

It depends on the Prolog system your are using. Most Prolog systems have a command line start where one can provide an initial Prolog text to be consulted and an initial Prolog goal to be run.

这里有一些例子,我将咨询和运行结合起来,形成一个联合目标:

Here are some examples, I have combined the consult and run into one conjunctive goal:

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

最好的问候

这篇关于Prolog中的命令行参数向量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆