Email list hosting service & mailing list manager

Asking introspection Shiro Kawai (04 May 2020 21:21 UTC)
Re: Asking introspection John Cowan (04 May 2020 21:21 UTC)
Re: Asking introspection Marc Nieper-Wißkirchen (05 May 2020 06:12 UTC)
Re: Asking introspection Shiro Kawai (11 May 2020 09:21 UTC)
Re: Asking introspection Lassi Kortela (11 May 2020 09:25 UTC)
Re: Asking introspection Shiro Kawai (11 May 2020 09:42 UTC)
Re: Asking introspection Marc Nieper-Wißkirchen (09 Jun 2020 08:41 UTC)
Re: Asking introspection Marc Nieper-Wißkirchen (27 Aug 2020 16:03 UTC)
Re: Asking introspection Shiro Kawai (27 Aug 2020 21:45 UTC)
Re: Asking introspection Marc Nieper-Wißkirchen (28 Aug 2020 05:30 UTC)

Re: Asking introspection Lassi Kortela 11 May 2020 09:25 UTC

> Gauche has values->list and values-ref.   It is indeed handy.
> However, it's a bit difficult to make those primitives cover the
> necessary situations.
> Suppose you want to branch by the number of values yielded by EXPR.
>
>     (if (= (values-length EXPR) 1)
>        (let ((val EXPR))   ;; fast path
>           ...)
>        (let ((vals (values->list EXPR))) ;; generic path
>           ...))
>
> You have to evaluate EXPR twice.   If you want to make it evaluate once,
> you have to reify it
> in some way, which defeats the original motivation to write this kind of
> code.

The case-receive (by analogy to case-lambda) proposed by Marc solves
this nicely.