For Programmers: Free Programming Magazines  


Home > Archive > Prolog > November 2007 > B-prolog : limited number of vars ?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author B-prolog : limited number of vars ?
Ecirbaf

2007-11-05, 7:13 pm

Hi !

I wanted to generalize a bp program thats solves things on a 3x3
board.

I saw in the B-Prolog doc that (even multidimensional) array was
provided.
However It was easier for me to generate B-Prolog source programs
from another language instead of learning more Prolog features.

So I wrote an OCaml program :
http://fabrice.marchant.free.fr/B-Prolog/wrPl.ml
that generated B-Prolog programs for any rectangular board test /
number of tested cells ( Game of Life / still lives, allways ).

The generated .pl worked fine up to a 7x7 board with 9 alive cells :
http://fabrice.marchant.free.fr/B-Prolog/auto779.pl

However :
http://fabrice.marchant.free.fr/B-Prolog/auto88-10.pl
that has 64 vars, can't compile.

Please are number of vars or some line length limitation with B-
Prolog ?

Thanks for any tip,

Fabrice

Neng-Fa Zhou

2007-11-05, 7:13 pm


"Ecirbaf" <fabrice.marchant@orange.fr> wrote in message
news:1194272220.023170.13070@v3g2000hsg.googlegroups.com...
>
> However :
> http://fabrice.marchant.free.fr/B-Prolog/auto88-10.pl
> that has 64 vars, can't compile.
>
> Please are number of vars or some line length limitation with B-
> Prolog ?


There is no limit on the number of variables included in a clause. Actually,
since registers are abounded in version 7.0, you'll never experience
register overflow.

I had no problem compiling your program on my notebook (Windows XP).

| ?- cl('auto88-10')
Compiling::auto88-10.pl
compiled in 15 milliseconds
loading::auto88-10.out

What OS are you using?

Cheers,
Neng-Fa




Ecirbaf

2007-11-05, 7:13 pm

> There is no limit on the number of variables included in a clause. Actually,
> since registers are abounded in version 7.0, you'll never experience
> register overflow.
>
> I had no problem compiling your program on my notebook (Windows XP).
>
> | ?- cl('auto88-10')
> Compiling::auto88-10.pl
> compiled in 15 milliseconds
> loading::auto88-10.out


Many thanks !

This way, with cl(), you said, it now works.

Maybe the issue com from the fact I used '[]' :

B-Prolog Version 7.0, All rights reserved, (C) Afany Software
1994-2007.

Type 'help' for usage.
| ?- [auto88-10]

*** error(type_error,compile(auto88-10))

Or 'compile()':

| ?- compile(auto88-10)

no
| ?-

> What OS are you using?

The problem occurred with debian linux Lenny for this question (but
I'm just upgrading to debian Sid today.)

Thanks again for your valuable help.

Regards,

Fabrice

Neng-Fa Zhou

2007-11-05, 7:13 pm


"Ecirbaf" <fabrice.marchant@orange.fr> wrote in message
news:1194280904.489070.174860@o80g2000hse.googlegroups.com...
>
> This way, with cl(), you said, it now works.
>
> Maybe the issue com from the fact I used '[]' :


It has nothing to do with cl or compile or []. In Prolog (I have to say most
Prolog systems), you have to single-quote a file name if the file name has a
hyphen (or any other special character) in it because a term like a-b is not
an atom but a structure.

Hope this is the quickest way for you to learn Prolog:-).

Cheers,
Neng-Fa



Ecirbaf

2007-11-05, 7:13 pm

On Nov 5, 6:35 pm, "Neng-Fa Zhou" <nz...@acm.org> wrote:
> "Ecirbaf" <fabrice.march...@orange.fr> wrote in message
>
> news:1194280904.489070.174860@o80g2000hse.googlegroups.com...
>
>
>
>
>
> It has nothing to do with cl or compile or []. In Prolog (I have to say most
> Prolog systems), you have to single-quote a file name if the file name has a
> hyphen (or any other special character) in it because a term like a-b is not
> an atom but a structure.

I should have thought to '-' as a special char by myself.

> Hope this is the quickest way for you to learn Prolog:-).

Apologize, I only wanted to learn a bit the langage : just enough to
see if it was useful to solve some problems and it is, indeed. That
makes desire to learn Prolog more deeply and to read some docs...

Regards,

Fabrice

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com