Re: Can i make a variable like those in imperative language ?
- From: Nick Wedd <nick@xxxxxxxxxxxxx>
- Date: Wed, 18 May 2005 12:54:33 +0100
In message <d6dkkc$f2p$1@xxxxxxxxxxxxxxxxx>, SoULiaNe <cubix_car@xxxxxxxx> writes
Hi, sorry for the newbie question and bad english...
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 !
I once wrote a module that added this ability to ESI's Prolog2. It could also be used to add it to other Prologs, but to install it you need to be able to intercept the Prolog system's parser.
It did not work at the string level (as it does in C) but at the structure level. It used # as a left operator, so you could #define the structure #n to be 5. Then the system's parser replaced #n by 5 wherever it found it.
I found it very useful, once I had written it. I am surprised that most Prolog systems don't support something like it.
Nick -- Nick Wedd nick@xxxxxxxxxxxxx .
- References:
- Can i make a variable like those in imperative language ?
- From: SoULiaNe
- Can i make a variable like those in imperative language ?
- Prev by Date: Re: deductive databases
- Next by Date: Re: Can i make a variable like those in imperative language ?
- Previous by thread: Re: Can i make a variable like those in imperative language ?
- Next by thread: Re: Can i make a variable like those in imperative language ?
- Index(es):
Relevant Pages
|
|