guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCHv2] Extensions for SRFI-171 (Transducers)


From: Colin Woodbury
Subject: Re: [PATCHv2] Extensions for SRFI-171 (Transducers)
Date: Sun, 25 Dec 2022 00:28:13 +0900
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0

Hi Linus, great to hear from you. Thanks for the feedback. I've attached new versions of the patches (with your suggested fix), and also an extra 4th commit that adds a short guide for how to write one's own Reducers.

Merry Christmas!

Colin

On 12/21/22 19:00, Linus Björnstam 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 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 code 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örnstam

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

Attachment: 0001-srfi-171-add-twindow-and-various-reducers.patch
Description: Text Data

Attachment: 0002-doc-add-new-SRFI-171-reducers-to-the-manual.patch
Description: Text Data

Attachment: 0003-srfi-171-add-unit-tests-for-new-functions.patch
Description: Text Data

Attachment: 0004-doc-added-a-guide-for-writing-custom-reducers.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]