causes that one goal implicates another goal....
Move to
=> <=
Darueber Spitze
See also
abort/0
::(Apply)/2
break
call/1
fcall/1
catch/3
','(Conjunction)/2
!(Cut)/0
';'(Disjunction)/2
<-(Eval)/2
fail/0
halt/0/1
->(If-then)/2
';'(If-then-else)/2
'\+'/1
once/1
repeat/0
throw/1
true/0
IF Computer > MINERVA > Manual > Reference > Predicates > Logic and control > ->(If-then)/2

->(If-then)/2

causes that one goal implicates another goal.

+IfGoal -> +ThenGoal
->(+IfGoal, +ThenGoal)

If IfGoal succeeds then ThenGoal will be executed.
If IfGoal fails ThenGoal will not be executed.
'->'/2 succeeds if IfGoal and ThenGoal both succeed.

There are two significant differences to ','/2:

  • Only ThenGoal can be backtraced. IfGoal can succeed only once.
  • If IfGoal has subgoals and also a Cut ('!'/0) this Cut has no effect outside of IfGoal.

'->'/2 is a predefined infix-operator with priority 1050 which is right-associative (see also current_op/3).

Arguments

IfGoal                 goal
ThenGoal               goal

Examples

There exists a database with clauses:
     colour(blue). colour(yellow).

colour(X) -> write(X). Succeeds once with substitution X <- blue
and outputs 'blue' to the current outputstream.
colour(X) -> X = yellow. Fails.

Standard

This predicate is part of the ISO-Prolog Standard.

See also

abort/0, break/0, call/1, fcall/1, catch/3, ','(conjunction)/2, '!'(cut)/0, ';'(disjunction)/2, fail/0, true/0, halt/0/1, ';'(if-then-else)/2, '\+'(not provable)/1, once/1, repeat/0, throw/1.

read on...
MINERVA
ifcomputer logo
f
Expert Services on the Web
Sprache
English
Japanese
Server
USA
Japan
Site Access
Local Index
Local Contents
Site Contents
Site Index
Printer Friendly
For imode
For PDA
Search
document: http://www.ifcomputer.co.jp/MINERVA/Manual/Reference/Predicates/logic_and_control/if_then/home_de.html
published 2008/5/12 update 2001/2/7 (c) 1996-2006 IF Computer Japan
IF Computer 5-28-2 Sendagi, Bunkyo-ku Tel +81-3-5814-3352 info@ifcomputer.com
Customer Support Tokyo 113-0022 Japan   http://www.ifcomputer.com
scroll to top managed with ubiCMS