l...@gnu.org (Ludovic Courtès) writes: > l...@gnu.org (Ludovic Courtès) skribis: > >> Andy Wingo <wi...@pobox.com> skribis: >> >>> On Thu 30 Jun 2011 12:44, Andy Wingo <wi...@pobox.com> writes: >>> >>>> I think we should add `when' and `unless' to the default environment. >>>> >>>> They go like this: >>>> >>>> (define-syntax when >>>> (syntax-rules () >>>> ((_ test then then* ...) >>>> (if test (begin then then* ... (if #f #f)))))) >>>> >>>> (define-syntax unless >>>> (syntax-rules () >>>> ((_ test else else* ...) >>>> (if (not test) (begin else else* ... (if #f #f)))))) >>> >>> WDYT? `unless' is nice for assertions, `when' is its converse, and most >>> Schemes have them. I would like to add them to Guile too. >> >> Yes, feel free. > > Like Marijn, it seems more natural for me to return the values of the > body’s last expression, rather than *unspecified*.
Can you explain how that would even make sense? You can't return a specified value when the condition is not true since then no form gets evaluated. So where is the point in returning a value that is only sometimes specified? "Sometimes specified" logically is pretty much the same as "unspecified", and then we might return *unspecified* right away. -- David Kastrup