[rules-dev] Backwards chaining: the difference between input and output variables

Mark Proctor mproctor at codehaus.org
Thu Apr 21 18:35:40 EDT 2011


http://www.cse.unsw.edu.au/~billw/cs9414/notes/prolog/intro.html
If Prolog finds a variable name that you only use once in a rule, it 
assumes that it may be a spelling mistake, and issues a *Warning* about 
a "singleton variable" when you load the code:

%/prolog -q -s mycode.pl/
Warning: .../mycode.pl:4:
    Singleton variables: [Item]


http://www.cs.toronto.edu/~dianaz/2501/Manual/sec-B.html

*singleton [variable]*
    Variable
    <http://www.cs.toronto.edu/%7Edianaz/2501/Manual/sec-B.html#gloss:variable>
    appearing only one time in a clause
    <http://www.cs.toronto.edu/%7Edianaz/2501/Manual/sec-B.html#gloss:clause>.
    SWI-Prolog normally warns for this to avoid you making spelling
    mistakes. If a variable appears on purpose only once in a clause,
    write it as |_| (see anonymous
    <http://www.cs.toronto.edu/%7Edianaz/2501/Manual/sec-B.html#gloss:anonymou>)
    or make sure the first character is a |_|. See also the
    style_check/1
    <http://www.cs.toronto.edu/%7Edianaz/2501/Manual/sec-3.42.html#style_check/1>
    option |singletons|



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-dev/attachments/20110421/2ecd34a5/attachment.html 


More information about the rules-dev mailing list