0

As a follow up to this, now I am wondering if there is a way to execute/evaluate a prolog predicate/expression straight from the shell, something like this:

$ swipl --eval "-:pack_install(something)"

Is something like that possible? Like in node.js, you can do:

$ node -e "console.log('hello world');"

And it will load up node, evaluate the expression, and close.

How do you do the equivalent in prolog?

Community
  • 1
  • 1
Lance
  • 75,200
  • 93
  • 289
  • 503

1 Answers1

2

It depends on the particular Prolog implementation. E.g. in SWI-Prolog, your can type:

$ swipl -g "write(hello), nl, halt"
hello

For more details, consult the man page:

$ man swipl
Paulo Moura
  • 18,373
  • 3
  • 23
  • 33