I have just written the following "hello world" program in Prolog. Although it is as simple as it can be, I would like your feedback as Prolog is very new to me.
#!/usr/bin/swipl -q -t main -f
main :-
write("Hello world!"), nl, fail.
Questions
- Shebang: I am used to use
#!/usr/bin/env python
in Python. This is the prefered method, because it does not rely (so much) on a specific system. - write: it seems as if I could also use
format
. Are there other options? - Style guide: I have not found any style guide regarding indentation or spaces after
,
. - Is quitting with
fail
to usual way? I have seenhalt
, too. - File ending: I saved it as
helloworld.pro
. What file extensions are common?
As the code is short and I have difficulties with even getting that to work with Prolog, I would admire it if you could add the complete code when you make suggestions.
.pl
is commonly used \$\endgroup\$ – tim Aug 6 '14 at 17:30?- main.
at the end. \$\endgroup\$ – C.B. Aug 6 '14 at 18:01