guile-devel
[Top][All Lists]
Advanced

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

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


From: Damien Mattei
Subject: Re: [PATCH] Extensions for SRFI-171 (Transducers)
Date: Thu, 22 Dec 2022 15:33:19 +0100

hello,
just trying transducers before using it, i try to understand.
what is wrong with that:
scheme@(guile-user)> (list-transduce (tfilter (λ (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.  Type `,bt' for a backtrace or `,q' to continue.

Regards,
Damien

On Wed, Dec 21, 2022 at 11:01 AM Linus Björnstam <linus.bjornstam@veryfast.biz> 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


reply via email to

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