[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: A problem in program
From: |
Gregory Bourassa |
Subject: |
Re: A problem in program |
Date: |
Mon, 23 Oct 2006 20:41:39 -0400 |
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==?=" <address@hidden> 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
address@hidden
<a href='http://lists.gnu.org/mailman/listinfo/users-
prolog'>http://lists.gnu.org/mailman/listinfo/users-prolog</a>