From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Damien Mattei Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH] Extensions for SRFI-171 (Transducers) Date: Thu, 22 Dec 2022 15:33:19 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000965c7505f06b8d76" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32674"; mail-complaints-to="usenet@ciao.gmane.io" To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Thu Dec 22 15:35:39 2022 Return-path: Envelope-to: guile-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p8Mfb-0008GO-Ca for guile-devel@m.gmane-mx.org; Thu, 22 Dec 2022 15:35:39 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p8Mdx-0002gD-Oj; Thu, 22 Dec 2022 09:33:58 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p8Mdc-0002fQ-Dv for guile-devel@gnu.org; Thu, 22 Dec 2022 09:33:36 -0500 Original-Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p8Mda-0007S5-Fk for guile-devel@gnu.org; Thu, 22 Dec 2022 09:33:36 -0500 Original-Received: by mail-ej1-x634.google.com with SMTP id t17so5373535eju.1 for ; Thu, 22 Dec 2022 06:33:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=hUTdavCT6CJwK0vX74pvdIF44HlVy/hqiOdXjyPw3F8=; b=NOlSFYjkcR6uU9OsRBoTPEId80r5qk/V9J652B0vITGdTmo74cgTXh5sr+aFDWjIpq KF6aeH0IT+FPU2mnkNwggflCOcG7etanZUpirSJiILjYgMaO+w1lZblmXOCCb59kJyhv bWrEjl4QNlo95mFtdbNCv+LpPfFjVr7hwXYaQptKbK5+Qt5UmRLT1CLKWKCEKaOAkNMd ekKcTD7dCgiHTd6uxkMzRMERSSNw3/wjoU/mNl9G0Zc7d8JI1iaSumhI3R2Eqt5KSi1F D+doazGuU/N0cP5SrREw6DeKKlZ5R7wcYEmGpsXyAD+522r2GWZmRA16DB5IWd+zpEM8 ia/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=hUTdavCT6CJwK0vX74pvdIF44HlVy/hqiOdXjyPw3F8=; b=W5h2fA/AM3SgwcRfjisp9dqds2ESDbEqER1j7pTNo6D890ODL1aXOuQ2eF22nI85bQ xW+48IrepQUlaaq80/H3SP1SU/ziZHnir4LzE70Wj8NTVI+xYTytxFgGTxA4idGClK3+ DFUDifhD69kT480NxMjsHEvQkKHc8n2tUfySsQfatYDRx5tji1+iZkM3fScDcrpF+4Ym kdoOpTDVRWhC4R+gvoL/wuwfJBJugebvzxNJkOhNF7IWlQXiWlt7KdzCstxS9IbAJxB/ SbBGG6G6FgphVb0veLL91EyrRHhe8fnybR4vrr6ATlEHqd5VGHpumh6fH3cZamffARk6 Ha8g== X-Gm-Message-State: AFqh2kpnwIBeiXAy3VPxQO1GAzrep45lJZB1jF5P7m9+yxuP5Zme2I1s Nc0Ds+rKVdF6q6SWTz6BII8OuUQC4bktCHFdxJzkk1HRpuF3sQ== X-Google-Smtp-Source: AMrXdXvusmEzUy2YNmxIKQjg/hvuhKkNk8Vv8B37SQ589wI8HPu8nHACURvzHCrFrJLnVAJSQJRpzyueT5D8E6+m7aU= X-Received: by 2002:a17:906:f857:b0:835:57c9:6424 with SMTP id ks23-20020a170906f85700b0083557c96424mr760898ejb.529.1671719611160; Thu, 22 Dec 2022 06:33:31 -0800 (PST) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::634; envelope-from=damien.mattei@gmail.com; helo=mail-ej1-x634.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.devel:21517 Archived-At: --000000000000965c7505f06b8d76 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable hello, just trying transducers before using it, i try to understand. what is wrong with that: scheme@(guile-user)> (list-transduce (tfilter (=CE=BB (x) x)) (tdelete-duplicates) (list 1 2 #f 3 3 4)) ice-9/boot-9.scm:1685:16: In procedure raise-exception: Wrong number of arguments to # Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue. Regards, Damien On Wed, Dec 21, 2022 at 11:01 AM Linus Bj=C3=B6rnstam < linus.bjornstam@veryfast.biz> wrote: > As the author of both the SRFI and the guile code I am very happy you lik= e > it. I don't have a computer at the moment, but I looked through the code > and it looked great. > > All additions should have been included in the original SRFI :) > > one comment: your code uses define-public, which the rest of SRFI-171 cod= e > does not. > > I am not in any position to sign code off for inclusion in guile proper, > but if the define-public thing is fixed it very much has my blessing. > > Best regards > Linus Bj=C3=B6rnstam > > On Wed, 21 Dec 2022, at 01:48, Colin Woodbury wrote: > > Happy holidays everyone, I hope everything is going well for you. > > > > Since discovering SRFI-171 (Transducers) I have fallen in love with it. > > Transducers let me "talk the way I want to talk" while knowing that I'm > > being efficient underneath w.r.t. to iteration and allocation. In using > > Guile's implementation, I noticed a few common idioms missing that are > > otherwise present in other languages, so I've added them in a series of > > patches. I've been using these often for a number of weeks without > > issue, but of course have added unit tests as well. > > > > The full details are in the commit messages, but here are the main > highlights: > > > > * rfold: The fundamental reducer. This allows the user to turn any > > two-arg function into a valid reducer, so that they don't need to worry > > about hand-writing reducers via case-lambda. > > * rfind: Yields the first item in the transduction that matches some > > predicate. Nice for locating some specific value from a potentially > > large data source (e.g. a port). > > * twindow: Like tsegment, but yields overlapping slices into the data. > > Cheers, and have a great holiday. > > > > Colin > > > > Attachments: > > * 0001-srfi-171-add-twindow-and-various-reducers.patch > > * 0002-doc-add-new-SRFI-171-reducers-to-the-manual.patch > > * 0003-srfi-171-add-unit-tests-for-new-functions.patch > > --000000000000965c7505f06b8d76 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
hel= lo,
just t= rying transducers before using it, i try to understand.
what is wrong with that:
scheme@(guile-user)> = (list-transduce (tfilter (=CE=BB (x) x)) (tdelete-duplicates) (list 1 2 #f = 3 3 4))
ice-9/boot-9.scm:1685:16: In procedure raise-exception:
Wrong= number of arguments to #<procedure 10786aa60 at srfi/srfi-171.scm:338:2= (reducer)>

Entering a new prompt.=C2=A0 Type `,bt' for a bac= ktrace or `,q' to continue.

Regards,
Damien

On Wed, Dec 21, 2022 at 11:01 AM Linus Bj=C3=B6rnstam <= linus.bjornstam@veryfast.bi= z> wrote:
As the author of both the SRFI and the guile code I am very happy you like= it. I don't have a computer at the moment, but I looked through the co= de and it looked great.

All additions should have been included in the original SRFI :)

one comment: your code uses define-public, which the rest of SRFI-171 code = does not.

I am not in any position to sign code off for inclusion in guile proper, bu= t if the define-public thing is fixed it very much has my blessing.

Best regards
=C2=A0 Linus Bj=C3=B6rnstam

On Wed, 21 Dec 2022, at 01:48, Colin Woodbury wrote:
> Happy holidays everyone, I hope everything is going well for you.
>
> Since discovering SRFI-171 (Transducers) I have fallen in love with it= .
> Transducers let me "talk the way I want to talk" while knowi= ng that I'm
> being efficient underneath w.r.t. to iteration and allocation. In usin= g
> Guile's implementation, I noticed a few common idioms missing that= are
> otherwise present in other languages, so I've added them in a seri= es of
> patches. I've been using these often for a number of weeks without=
> issue, but of course have added unit tests as well.
>
> The full details are in the commit messages, but here are the main hig= hlights:
>
>=C2=A0 * rfold: The fundamental reducer. This allows the user to turn a= ny
> two-arg function into a valid reducer, so that they don't need to = worry
> about hand-writing reducers via case-lambda.
>=C2=A0 * rfind: Yields the first item in the transduction that matches = some
> predicate. Nice for locating some specific value from a potentially > large data source (e.g. a port).
>=C2=A0 * twindow: Like tsegment, but yields overlapping slices into the= data.
> Cheers, and have a great holiday.
>
> Colin
>
> Attachments:
> * 0001-srfi-171-add-twindow-and-various-reducers.patch
> * 0002-doc-add-new-SRFI-171-reducers-to-the-manual.patch
> * 0003-srfi-171-add-unit-tests-for-new-functions.patch

--000000000000965c7505f06b8d76--