Functional Problem Solving (CSC 151 2015F) : Reference

Conditionals


(if test consequent alternative)
Standard keyword. Evaluate test. If its value is truish (that is, anything but false), evaluate consequent and return its value. If the value of test is false (#f), evaluate and return alternative.
(when test exp1 exp2 ... expn)
Optional Scheme Keyword. Evaluate test. If it holds, evaluate each expression in turn. Otherwise, do nothing.
(cond (test1 consequents1) (test2 consequents2) ... (testn consequentsn) (else alternative))
Standard keyword. Evaluate each test in turn until one is truish. It then evaluates the corresponding sequence of consequent expressions and returns the value of the last consequent. If none of the tests is truish, evaluates the alternative and returns its value.
(and exp1 exp2 ... expn)
Standard keyword. Evaluate each expression in turn. If any of those values is false, return false. Otherwise, return the value of the last expression.
(or exp1 exp2 ... expn)
Standard keyword. Evaluate each expression in turn. If any of those values is true, return true. Otherwise, return the value of the last expression.