[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Find an element in a functional set (guile-pfds)
From: |
Maxime Devos |
Subject: |
RE: Find an element in a functional set (guile-pfds) |
Date: |
Sun, 7 Jul 2024 13:01:29 +0200 |
>Maybe bbtree-fold can be used, but
that would not "early exit" as soon as it has found an item, that satisfies
some
specified predicate.
You can use escape continuations to do an early exit:
;; On success, return stuff-to-return. Otherwise, return the symbol ‘no-match’.
(let/ec escape
(bbtree-fold [...] [... when a match is found, use (escape stuff-to-return)]
[...])
'no-match)
Best regards,
Maxime Devos.