4

I've been using the gprolog thingy to do some things in prolog. But now when testing some more code I discovered that it does not support "false". Which is supported by swi?

false
  • 10,264
  • 13
  • 101
  • 209
Algific
  • 1,470
  • 2
  • 18
  • 33

2 Answers2

8

Use fail instead of false. I believe the former is in the ISO standard for Prolog. Otherwise, define it yourself:

false :- 0=1.

or

fail :- 0=1.
Fred Foo
  • 355,277
  • 75
  • 744
  • 836
  • 4
    Wouldn't `false :- fail.` be a clearer definition, since you somehow imply that they have the same effect and/or are synonyms? – Giulio Piancastelli Nov 13 '10 at 10:01
  • What I meant was: if neither is available, this is how implement one of them. Changed my answer. – Fred Foo Nov 13 '10 at 12:21
  • 4
    In the meantime, ISO Prolog now has both `fail` and `false`. It is available in GNU and many other systems. – false Feb 16 '12 at 23:26
4

Recent versions of GNU Prolog (1.4.0) do support false/0.

false/0 is not defined in the original ISO standard of 1995, but is part of Cor.2:2012.

false
  • 10,264
  • 13
  • 101
  • 209