Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working for me #22

Open
agzam opened this issue Nov 16, 2020 · 4 comments
Open

Not working for me #22

agzam opened this issue Nov 16, 2020 · 4 comments

Comments

@agzam
Copy link

agzam commented Nov 16, 2020

I'm having the same issues as described in #21 and in #18

I'm trying it with swi and gnu-prolog, when (setq org-babel-prolog-command "swipl") the following block:

#+begin_src prolog
write('hello').
#+end_src

produces no output. There's a message "Code block produced no output.", and indeed, there's none whatsoever;

When (setq org-babel-prolog-command "gprolog"), the same block produces:

| GNU       | Prolog |     1.4.5 | (64    | bits)    |      |       |
| Compiled  | Aug    |        20 | 2018,  | 15:27:00 | with | clang |
| By        | Daniel |      Diaz |        |          |      |       |
| Copyright | (C)    | 1999-2018 | Daniel | Diaz     |      |       |
|           |        |        ?- |        |          |      |       |

And nothing else. What am I missing?

  • Org mode version 9.4 (9.4-31-g49f4c3-elpaplus)
  • GNU Emacs 28.0.50 (build 1, x86_64-apple-darwin19.6.0, NS appkit-1894.60 Version 10.15.7 (Build 19H2))
@tonikazic
Copy link

I didn't get your code block to work, but I am able to format/3 to a file correctly. I think perhaps the problem is with your switches, but

#+begin_src prolog :results output
format('hello~n',[]).
#+end_src

doesn't output anything.

For writing to a file, my switches are:

#+begin_src prolog :results file :file counts.csv
...

and a link to the output file appears as expected.

My setup:

  • GNU Emacs 27.1 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1671.60 Version 10.14.6 (Build 18G95)) of 2020-08-12

  • Org mode version 9.3 (release_9.3 @ /Applications/Emacs.app/Contents/Resources/lisp/org/)

  • SWI-Prolog (threaded, 64 bits, version 8.0.3)

  • /Applications/Emacs.app/Contents/Resources/site-lisp/ob-prolog.el

I hope this is some help.

@Alf0nso
Copy link

Alf0nso commented Mar 15, 2021

I tried to run as well and it gives no output
I'm using:

  1. Emacs GNU Emacs 27.1 (build 1, x86_64-w64-mingw32) of 2020-08-21
  2. Org mode version 9.3 (release_9.3 @ c:/Emacs/x86_64/share/emacs/27.1/lisp/org/)
  3. SWI-Prolog (threaded, 64 bits, version 8.2.4)

I believe it might there be something wrong with the lisp on ob-prolog

@chewblacka
Copy link

chewblacka commented Oct 27, 2021

I'm having the same issues as described in #21 and in #18

I'm trying it with swi and gnu-prolog, when (setq org-babel-prolog-command "swipl") the following block:

#+begin_src prolog
write('hello').
#+end_src

produces no output. There's a message "Code block produced no output.", and indeed, there's none whatsoever;

To get that to work with SWI-prolog you need to specify it as a goal. So either:

#+begin_src prolog :results output
:-write('hello').
#+end_src

or

#+begin_src prolog :results output :goal a 
a:-write('hello').
#+end_src

should both work and will produce the output:

#+RESULTS:
: hello

@chewblacka
Copy link

chewblacka commented Oct 27, 2021

And in general if you want to run a program which doesn't produce any output e.g. with the write/2 predicate, then you need to run it in session mode. For example a simple factorial predicate might be run as:

#+BEGIN_SRC prolog :results output :session :goal fact(7,F)
fact(0,1).
fact(N,F):-
    N #> 0,
    F #> 0,
    N1 #= N-1,
    F #= N*F1,
    fact(N1,F1).
#+END_SRC

It will produce the result:

#+RESULTS:
: F = 5040.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants