Re: Can i make a variable like those in imperative language ?



SoULiaNe wrote:

I want to have a program parameter in Prolog just like what we can do in C with something like "#define N 5". It is not necessary to be a constant, so a variable can be suffisant... but how to make a variable in Prolog ? I mean a variable like those in imperatives languages.


Thank you !

Afaik, only PDC Prolog allows you to declare constants in that way at this time, as in

  CONSTANTS

    dummy_var_char = '#'

    keyword_flag = '$'

    c_debug = 1
    c_no_debug = 0

but there is nothing to stop you from embedding your own macro
calls in your Prolog text  and running it through a macro
preprocessor before you send it to your Prolog
compiler/interpreter.

--
.