I've read this in SICP book from MIT-OCW:

"A minor difference between

`if`and

`cond`is that the <

*e*> part of each

`cond`clause may be a

**sequence of expressions**. If the corresponding <

*p*> is found to be true, the expressions <

*e*> are evaluated in sequence and the value of the final expression in the sequence is returned as the value of the

`cond`. In an

`if`expression, however, the <

*consequent*> and <

*alternative*> must be single expressions. "

so i tried this in scheme:

(define (test a b)

(cond ((> a b) ((- a 1) (- b 1)))

((< a b) ((+ a 1) (+ b 1)))

(else((+ a b) (- a b)))))

(test 3 2)

it returned:

*procedure application: expected procedure, given: 2; arguments were: 0*

What I'm trying to do is: given a single predicate, evaluate multiple expressions (like the ones above, evaluate both (- a 1) and (- b 1)

i thought this is possible: (because of what i've read- or maybe i just don't understand it)

(cond <predicate> (<exp1> <exp2> <exp3>))- but it always result in an error

Can some one help me with this? What is meant by

**sequence of expressions?**

Thank you very much

Eljon

## Error

Your IP address will be recorded

You must follow the Privacy Policy and Google Terms of use.