Re: A problem in program

"Gregory Bourassa" <[email protected]>
Newsgroups gmane.comp.gnu.prolog.general
Message-ID <[email protected]>
Yang,

I assume you do know that the token, first, cannot be treated as a variable because it 
starts with a lowercase letter.

If you want to get the list's first element into a variable named "First",  the initial 
letter must be a capital as in:

    L = [First|_],
    write('first = '),write(First),nl,

The token, first,  is seen by Prolog as a symbol atom, not a variable.

Regards.

Gregory Bourassa


On Oct 23, "=?gb2312?B?1dTR9A==?=" <[email protected]> wrote:
Hi, all:
    Now I encounter a problem in programming. Consider the follow program.
    
q :-.......    
    solve_propagate(L,Line1,Line2),!,
    write('propagate success!'),nl,
    L = [first|_],
    write('first = '),write(first),nl,
    stato_img(CL,CLine1,CLine2,first),
    ......

    the first call solve_propagate() has bound the L, Line1, Line2(they are all list). I 
want get the fisrt element of L (variable first) and use to in the next call stato_img
(). But it does not work. The program stops at L = [first|_] and gives a warning "user 
directive failed". 
    I want to know what the problem is and how to solve it. Thank you!
 

Zhao, Yang
2006-10-23
 
_______________________________________________
Users-prolog mailing list
[email protected]
<a href='http://lists.gnu.org/mailman/listinfo/users-
prolog'>http://lists.gnu.org/mailman/listinfo/users-prolog</a>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.