From: "Hans Åberg" <haberg-1@telia.com>
To: Taylan Kammer <taylanbayirli@gmail.com>
Cc: guile-devel <guile-devel@gnu.org>
Subject: Re: speedup of modifying return values
Date: Wed, 29 Aug 2018 22:54:56 +0200 [thread overview]
Message-ID: <09C54F8B-FB44-4DA6-B618-DE196A41E0EB@telia.com> (raw)
In-Reply-To: <87h8jdc8o3.fsf@gmail.com>
> On 29 Aug 2018, at 20:46, Taylan Kammer <taylanbayirli@gmail.com> wrote:
>
> Stefan Israelsson Tampe <stefan.itampe@gmail.com> writes:
>
>> Hi all, I'm trying to make a python clone in guile. Currently the code is slow and one of the reasons is the following,
>>
>> in my pythoon
>>
>> return 1,2
>>
>> returns a (values 1 2) in order to get python and scheme to interoperate. but for python if you use
>>
>> x = 1,2
>>
>> then x is the tupple '(1 2) and in guile it is 1. So therefore we wrap the result for
>>
>> x=f(10)
>>
>> as
>> (set! x (call-with-values (lambda () (f x)) (case-lambda ((x) x) (x x))))
>>
>> This can be compiled to efficient bytecode but is not done so in guile. In stead a closure is created at each assignment site and creating ineficient code.
>>
>> Any ideas how to improve this (I don't want "return a,b" to mean (list a b) which is a quick solution
>> if we want to just stay in python and not interoperate with scheme at all on this level.
>
> Sounds like a fun project. :-)
>
> Idea:
>
> Make Python tuples a new data type, instead of multi-values.
>
> The fact that they can be stored in a single storage location in Python
> means that they are actually a data type, only special-handled for
> automatic destructuring in some places...
Indeed, the problem is that in Scheme, (list f x₀ …), using normal infix tuple notation, creates the deferred function object f(x₀, …), and I found it hard to write a normal function call language on top of that.
next prev parent reply other threads:[~2018-08-29 20:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-29 10:58 speedup of modifying return values Stefan Israelsson Tampe
2018-08-29 18:46 ` Taylan Kammer
2018-08-29 20:54 ` Hans Åberg [this message]
2018-08-29 22:53 ` Matt Wette
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=09C54F8B-FB44-4DA6-B618-DE196A41E0EB@telia.com \
--to=haberg-1@telia.com \
--cc=guile-devel@gnu.org \
--cc=taylanbayirli@gmail.com \
/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).