SWI-Prolog : "safe" atom_number?



I want to be able to call atom_number/2 in a manner that does not
disrupt program flow if the term being converted is not a number.
Currently, calling atom_number/2 with a non-numeric term generates a
syntax error.

I tried wrapping atom_number/2 in a catch() statement, but the syntax
error is still generated. I want the call to simply fail if I pass a
non-numeric quantity.

How can I do this?

Thanks.

.



Relevant Pages

  • Re: SWI-Prolog : "safe" atom_number?
    ... calling atom_number/2 with a non-numeric term generates a ... syntax error. ... "I want to be able to call atom_number/2 in a manner that does not ... disrupt program flow if the term being converted is not a number" ...
    (comp.lang.prolog)
  • Re: SWI-Prolog : "safe" atom_number?
    ... disrupt program flow if the term being converted is not a number. ... calling atom_number/2 with a non-numeric term generates a ... syntax error. ...
    (comp.lang.prolog)
  • Re: SWI-Prolog : "safe" atom_number?
    ... calling atom_number/2 with a non-numeric term generates a ... syntax error. ... I tried wrapping atom_number/2 in a catchstatement, ... ?- catch, _, fail). ...
    (comp.lang.prolog)
  • Re: Counting Program
    ... Received the following error: realcountin.rb:3 unterminated string ... realcounting.rb:3: syntax error, unexpected $end, expecting ')' ... I mean in a manner that allows user input. ...
    (comp.lang.ruby)