[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] values

Razvan Rotaru scripsit:

> The truth is most of the time I'm interested in one value, not all
> of them. In my oppinion Lisp is right when assuming that one of the
> values returned as result is more important than others, and does not
> raise an error when I use such a function in a context where only one
> result is expected.

Use this trivial wrapper:

(define-syntax strip-values
  (syntax-rules ()
    ((strip-values exp)
       (lambda () exp)
       (lambda x (if (null? x) 'bogus (car x)))))))

> Additionally, in the way scheme treats multiple values, there is
> little difference between returning a list with the values, and
> returning the values as such (using the (values ...) form). I could
> very well use the list, and would not need to have the (values ...)
> form built into the language.

You could.  However, there may be a difference in performance.

An observable characteristic is not necessarily         John Cowan
a functional requirement.  --John Hudson                cowan@x

Scheme-reports mailing list