RE: Find an element in a functional set (guile-pfds)

Maxime Devos via General Guile related discussions <[email protected]>
Newsgroups gmane.lisp.guile.user
Message-ID <[email protected]>
>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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.