From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Amirouche Boubekki Newsgroups: gmane.lisp.guile.user Subject: Re: Guile fibers return values Date: Tue, 14 Jan 2020 10:59:18 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="45098"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Guile User To: Zelphir Kaltstahl Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Tue Jan 14 11:59:46 2020 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1irJvF-000BFA-Qk for guile-user@m.gmane-mx.org; Tue, 14 Jan 2020 11:59:45 +0100 Original-Received: from localhost ([::1]:36822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1irJvE-0007Ds-Bt for guile-user@m.gmane-mx.org; Tue, 14 Jan 2020 05:59:44 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47288) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1irJv2-0007Dk-PX for guile-user@gnu.org; Tue, 14 Jan 2020 05:59:33 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1irJv1-00060k-J3 for guile-user@gnu.org; Tue, 14 Jan 2020 05:59:32 -0500 Original-Received: from mail-vk1-xa34.google.com ([2607:f8b0:4864:20::a34]:35491) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1irJv1-00060G-Eh for guile-user@gnu.org; Tue, 14 Jan 2020 05:59:31 -0500 Original-Received: by mail-vk1-xa34.google.com with SMTP id o187so3481159vka.2 for ; Tue, 14 Jan 2020 02:59:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=E3bTLZGO9tFlGdmS8q/GhBMWafr+nap4zyIlxtJwSFY=; b=YohpcT7NecTFNO9AHQmOR+aNko3v5I82voYhJlErJ3i0TTf8cvW56l5hyGZF2eCYfx BBf6BCPYIgAsxzzE4Pso+sCoyzCoSnGP9CmlQMyAJF1HHVP4OfP3S9hDR5QzMK0aiv9v 015GZXr6k+gzaw65zM4gKwIL3rlA6gR63hSv0kJzaE+YkkPvQBaMsE5X0I6howrCgKz8 HZhv+IOkZVrd3jhvvIheGjSB38pLlaOV4tLlxeEbWlf5pLaEjIKhALOp+4CU8mkItn2f z/fhGbE3NVwZncEpdOsLqJ9ZWLBT08oHYBsoA+GzRKjlHDnrAZ9SwWtdzebcrgzaZlmm Sq1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=E3bTLZGO9tFlGdmS8q/GhBMWafr+nap4zyIlxtJwSFY=; b=P6H4eI5sMKiKBmdmZtNXpzCMT4J98HU9YRnqj+qDV5TbOXBpQJSxME0/tsz/e/O4xQ XsIAXVfgAJcOkA2M5evDck1mISTTYCSOguxrDfLrEl472mVgogWd801b16cn+F7CtYwH bwd8mnf4QjZB7RPj0zIW1pfEio1H3poz5uqTvIyO3Mv8ROoxVv0lojpXIzheOTJPtjQD 4m/x6c9h4h6NbZqe5HZwJIZRR2Hv3CD0h+pwJeECdCfrxBAka7yOe9N3OMXFFJ4/fdQl wW5CD3d68QOYKWyCvd5x1Y5A/GizfpSSdXrtKCg7xn/Ws+yW7zW9uxecPVfjeAvAqOlh iVRQ== X-Gm-Message-State: APjAAAWYULHnq9NxafdaZ22VpmJzyxYCRSdNMVXWlmkyY3RlrNNPMSvC +07S7fzCNR/s8AUX20Mi58g68TUPqr1GmOQIWlY= X-Google-Smtp-Source: APXvYqwvZpp21xPLawIhHcBE2AWIRw9H6pFu6Ayh4lE6U0xzOyipH8AKLhPFWusYoAaHhXuMCkWzbiFIoj6U78DJzlg= X-Received: by 2002:a1f:4104:: with SMTP id o4mr13969141vka.80.1578999569458; Tue, 14 Jan 2020 02:59:29 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::a34 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.org gmane.lisp.guile.user:16054 Archived-At: Hello Zelphir! Le sam. 4 janv. 2020 =C3=A0 22:49, Zelphir Kaltstahl a =C3=A9crit : > > Hello Guile users! > > I have questions regarding the usage of the fibers library. It seems, > that I cannot find any way to get a computation result back from a > fiber. I also cannot find anything about how to get a value back from a > fiber, except for channels. The examples include one example using the > procedure `make-channel`, to create one channel for a client to send to > a server and one channel to use for the server to send messages to the > client. > > Are channels the only way to get a computation result back from a fiber? > > Should I be creating channels, which the spawned fiber then can use on > its own, to asynchronously give me a result? > > This is an aside of my actual project currently. I want to parallelize > some algorithm and want to make use of fibers for that, but in order to > do that, I must understand how to run multiple fibers and get their > results back. > > Can you give me an example, where fibers are used to split up a > computation heavy task so that it is sped up, because of running on > multiple cores? > For that last bit, I have done the following in babelia: https://github.com/amirouche/guile-babelia/blob/87ae25b56777ab6072759bbe8= 0bb80851d0d9174/babelia/pool.scm#L89-L108 I am wondering why the existing parallel for do not work for you: https://www.gnu.org/software/guile/manual/html_node/Parallel-Forms.html > Regards, > > Zelphir > > --=20 Amirouche ~ https://hyper.dev