First off, as Prolog itself is telling you, it is reading -color(foo)
as -(color(foo))
. That's why it's complaining about (-)/1
and not -color
. You cannot begin an atom with a hyphen.
Second, you want asserta/1
or assertz/1
, not assert/1
.
Third, when you declare a dynamic predicate with arity 4, you should use it with arity 4, not arity 1. In other words, your dynamic should either read :- dynamic color/4
and be used asserta(color(Red,Green,Blue,Alpha))
or it should read :- dynamic color/1
and be used asserta(color(red))
. The combination /4
with /1
is not what you mean.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…