From: szgyg <szgyg@freemail.hu>
Subject: Re: values->list elements
Date: Tue, 13 Jun 2006 19:20:47 +0200 [thread overview]
Message-ID: <448EF3EF.7010006@freemail.hu> (raw)
In-Reply-To: <448E12B1.8070709@fastmail.fm>
Jon Wilson wrote:
> Is there any sensible way to implement the following semantics:
>
> (+ (values 1 2))
> ==>
> 3
>
> Or perhaps with a macro of some sort (but preferably as above)...
>
> (+ (values->list-elements (values 1 2)))
> ==>
> 3
! untested code !
(define-macro (values->list vs)
`(call-with-values (lambda () ,vs) list))
(apply + (values->list (values 1 2 3)))
or
(define-macro (make-cockeyed-function f)
`(lambda (vs) (apply ,f (values->list vs))))
((make-cockeyed-function +) (values 1 2 3))
> The intermediate step (after the macro expansion I guess) would look like
>
> (+ 1 2)
No, this is impossible without redefining +. A macro produces 1 sexp,
not more.
> It seems like this would make multiple values much much more useful.
szgyg
ps: GNU Free Software Directory list guile-1.6.7 as recent
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user
next prev parent reply other threads:[~2006-06-13 17:20 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-13 1:19 values->list elements Jon Wilson
2006-06-13 17:20 ` szgyg [this message]
2006-06-13 19:02 ` Jonathan Wilson
2006-06-16 5:51 ` szgyg
2006-06-16 8:00 ` Neil Jerram
2006-06-16 18:15 ` szgyg
2006-06-19 0:51 ` Jon Wilson
2006-06-19 1:12 ` Per Bothner
2006-06-13 21:14 ` Neil Jerram
2006-06-13 21:17 ` Neil Jerram
2006-06-13 22:04 ` Jonathan Wilson
2006-06-13 22:24 ` Per Bothner
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=448EF3EF.7010006@freemail.hu \
--to=szgyg@freemail.hu \
/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).