Re: findall resulting in strange message

From: Fabian Reck <fre_at_informatik.uni-kiel.de>
Date: Fri, 19 Apr 2013 18:28:08 +0200


>
> In the meantime, I had already come across the libraries AllSolutions
> and SearchTree, which worked fine for me. I understand that AllSolutions
> uses fixed search strategies, while SearchTree allows you to choose
> different search strategies, including ones you have defined yourself.
>
> However, it seems that when using the SearchTree library, you always
> have to explicitly construct the search tree first and then turn it into
> a list. Is there also a convenience function that takes a search
> strategy and an expression and gives you an I/O action yielding a list
> of search results? The type of such a function should be something like
>
> (SearchTree a -> ValueSequence a) -> a -> IO [a] .
>

Hello,

there is no such function in the SearchTree module, but we should
definitely add one. It is quite easy to implement the function you are
asking for:

getAllValuesWith :: (SearchTree a -> ValueSequence a) -> a -> IO [a]
getAllValuesWith strategy exp = do
  t <- getSearchTree exp
  return (vsToList (strategy t))

Regards,
Fabian



_______________________________________________
curry mailing list
curry_at_lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry

Received on Fr Apr 19 2013 - 21:55:38 CEST

This archive was generated by hypermail 2.3.0 : Do Feb 01 2024 - 07:15:11 CET