guile-devel
[Top][All Lists]
Advanced

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

call with value


From: Stefan Israelsson Tampe
Subject: call with value
Date: Sun, 12 Apr 2020 18:58:46 +0200

I have this (on guile 3.0.0),

(define (f x) (call-with-values (lambda () x) (case-lambda ((x) ...) (x ...)))))

and the code does not simplify to (define (f x) x), why?

It would be great to have guile optimize this as in python we have

x=1,0
=> x=(1,0)

And the great thing with python on guile is that we get the same behavior with (values 1 0) as a r.h.s. so that we get good interoperability between guile and python.

This is implemented as

(call-with-values (lambda () r.h.s.)
   (case-lambda 
      ((x) x)
      (x   x)))

This has nice semantics but is expensive. Many times we can prove that r.h.s. has a single value return and we would like to be speed optimal for this case. I do not think that the python compiler should do this analysis or what do you think?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]