ERROR: Type error: `dict' expected, found `c' (an atom)

3,373 views
Skip to first unread message

Rafi Hai

unread,
Oct 28, 2016, 5:03:11 AM10/28/16
to SWI-Prolog
Hi fellow SWI-Prolog users,

I am trying to represent a list in Prolog. According to Programming for Artificial Intelligence book (Ivan Bratko) a list can be both represented in the normal representation as the inherent one provided by Prolog (as a tree).

For example: a list of elements a,b,c:
Should be possible to represent by List = [a,b,c]   OR    List = .(a, .(b, .(c,[]) ) ).

But using the second representation on the command line generates the mentioned error: ERROR: Type error: `dict' expected, found `c' (an atom)
Does anyone have an idea why?

Torbjörn Lager

unread,
Oct 28, 2016, 5:08:58 AM10/28/16
to Rafi Hai, SWI-Prolog
Hi Rafi,

The following section in the manual explains why:

http://www.swi-prolog.org/pldoc/man?section=ext-lists

Regards,
Torbjörn

--
You received this message because you are subscribed to the Google Groups "SWI-Prolog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swi-prolog+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/swi-prolog.
For more options, visit https://groups.google.com/d/optout.



--
Torbjörn Lager
Professor of General and Computational Linguistics
Department of Philosophy, Linguistics and Theory of Science
University of Gothenburg
Box 200, SE-405 30 Gothenburg, Sweden
Phone: +46317864962

Boris Vassilev

unread,
Oct 28, 2016, 5:09:10 AM10/28/16
to SWI-Prolog
Basically, instead of ./2 the functor for lists is now '[|]'/2.

==
?- List = '[|]'(a, '[|]'(b, '[|]'(c, []))).
List = [a, b, c].
==


Save our in-boxes! http://emailcharter.org

Reply all
Reply to author
Forward
Message has been deleted
0 new messages