unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: guile-devel@gnu.org
Subject: peval & let-values
Date: Wed, 21 Sep 2011 15:28:54 +0200	[thread overview]
Message-ID: <87ty86xbvt.fsf@gnu.org> (raw)
In-Reply-To: 87boueic7c.fsf@pobox.com

[-- Attachment #1: Type: text/plain, Size: 421 bytes --]

Hi,

Andy Wingo <wingo@pobox.com> skribis:

> Firstly, I added a let-values inliner to peval.  It was fairly pleasant
> to write.  It can do things like:
>
> (let ((x 0))
>   (call-with-values
>       (lambda () (if (zero? x) (values 1 2) (values 3 4)))
>     (lambda (a b)
>       (+ a b))))
> => 3

This example doesn’t seem to work as is, presumably because
‘call-with-values’ doesn’t get “primitivized”:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 560 bytes --]

diff --git a/test-suite/tests/tree-il.test b/test-suite/tests/tree-il.test
index 63b74ad..0074aa0 100644
--- a/test-suite/tests/tree-il.test
+++ b/test-suite/tests/tree-il.test
@@ -621,6 +621,15 @@
     (const 3))
 
   (pass-if-peval
+    ;; First order, let-values.
+    (let ((x 0))
+      (call-with-values
+          (lambda () (if (zero? x) (values 1 2) (values 3 4)))
+        (lambda (a b)
+          (+ a b))))
+    (const 3))
+
+  (pass-if-peval
     ;; First order, coalesced.
     (cons 0 (cons 1 (cons 2 (list 3 4 5))))
     (const (0 1 2 3 4 5)))

[-- Attachment #3: Type: text/plain, Size: 10 bytes --]


Ludo’.

  parent reply	other threads:[~2011-09-21 13:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-21  7:31 thoughts on peval Andy Wingo
2011-09-21  9:31 ` Ludovic Courtès
2011-09-21 10:32   ` Andy Wingo
2011-09-21 12:26     ` Ludovic Courtès
2011-09-21 13:28 ` Ludovic Courtès [this message]
2011-09-21 17:54   ` peval & let-values Andy Wingo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ty86xbvt.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).