Evaluates foo, then bar(s), and returns the result of evaluating foo and discards the results of bar(s).
Useful if `foo` is the condition and you need to perform some change to it immediately after, eg:
(while (prog1 (< next prev) (setq prev next)) ...)
---
(prog2 foo bar baz*)
Evaluates foo, then bar, then baz(s) (if present), returns the result of evaluating bar and discards the results of evaluating foo and baz(s).
Might be what GP wants. `foo` is the preparation, `bar` is the condition`, and `baz` can be some post-condition mutation on the compared value. Not too dissimilar to
for (pre, cond, post) {}
With `prog2` you could achieve similar behavior with no built in `for`:
(while (prog2 pre cond post) ...)
---
(progn foo*)
Evaluate each foo in order, return the result of evaluating the last element of foo and discard all the others.
`progn` is similar to repeated uses of the comma operator in C, which GP has possibly overlooked as one solution.
---
Evaluates foo, then bar(s), and returns the result of evaluating foo and discards the results of bar(s).Useful if `foo` is the condition and you need to perform some change to it immediately after, eg:
--- Evaluates foo, then bar, then baz(s) (if present), returns the result of evaluating bar and discards the results of evaluating foo and baz(s).Might be what GP wants. `foo` is the preparation, `bar` is the condition`, and `baz` can be some post-condition mutation on the compared value. Not too dissimilar to
With `prog2` you could achieve similar behavior with no built in `for`: --- Evaluate each foo in order, return the result of evaluating the last element of foo and discard all the others.`progn` is similar to repeated uses of the comma operator in C, which GP has possibly overlooked as one solution.