[Haskell-beginners] Filter to a list of function

Igor Pinheiro Leão ivpcl at cin.ufpe.br
Sun Jul 7 20:09:01 CEST 2013


Thank you Benjamin and Brent!
Brent, yes, that was exactly what i wanted to do. Thank you!

Kind regards,
Igor



2013/7/7 Brent Yorgey <byorgey at seas.upenn.edu>

> No need to apologize for grammar. =) There are lots of people in the
> Haskell community with many different levels of English fluency, we
> all just try to communicate as best we can.
>
> As for your question, I am not quite sure I understand what you want.
> Do you mean that you want to "zip" the lists together, applying each
> function to one element?  As in
>
>   specificFilter [(>3), even, (<19)] [6, 7, 8] = [6,8]
>
> because 6>3 and 8>19 (but 7 is not even)?
>
> If that is what you mean, then you could do something like
>
>   specificFilter ps xs = map snd . filter fst $ zipWith (\p x -> (p x, x))
> ps xs
>
> If you mean something else, then maybe you could give some examples of
> what you want?
>
> -Brent
>
> On Sun, Jul 07, 2013 at 02:32:21PM -0300, Igor Pinheiro Leão wrote:
> > Hum.. really sorry about the grammar mistakes.
> >
> >
> > 2013/7/7 Igor Pinheiro Leão <ivpcl at cin.ufpe.br>
> >
> > > Hi Guys,
> > > sorry in upsetting you again.
> > > Is there a way in which I can filter one list of function, one
> function at
> > > time, to a list of elements, declaring this and only this function.
> > >
> > > It would be exactly like this:
> > >
> > > specifcFilter :: [(a->Bool)] -> [a] -> [a]
> > >
> > > where for each element of type 'a' on the second list it would exist a
> > > function on  the first list that would be applied to it filtering.
> > >
> > > Kind regards,
> > > Igor
> > >
> > >
> > > --
> > > Igor Vinícius
> > > Graduando em Ciência da Computação
> > >
> >
> >
> >
> > --
> > Igor Vinícius
> > Graduando em Ciência da Computação
>
> > _______________________________________________
> > Beginners mailing list
> > Beginners at haskell.org
> > http://www.haskell.org/mailman/listinfo/beginners
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>



-- 
Igor Vinícius
Graduando em Ciência da Computação
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20130707/ee88e8bd/attachment-0001.htm>


More information about the Beginners mailing list