<div dir="ltr">Thanks a lot guys you were really helpful<div><br></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">func f1 f2 x = (f1 x) || (f2 x) is working for me</span></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br></span></font></div><div><div><br><br><div class="gmail_quote">On Sun, Apr 18, 2010 at 6:27 PM, Thomas Davie <span dir="ltr"><<a href="mailto:tom.davie@gmail.com">tom.davie@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">To do this, you need not just fmap (composition), but also ap, or the combined form, liftA2:<br>
<br>
func = liftA2 (||)<br>
<br>
Bob<br>
<div><div></div><div class="h5"><br>
On 18 Apr 2010, at 18:21, Keith Sheppard wrote:<br>
<br>
> Using composition can be tricky with more than one arg. I just want to<br>
> be sure you're not really looking for something like:<br>
><br>
>> func :: (a -> Bool) -> (b -> Bool) -> (a -> b -> Bool)<br>
><br>
> keeping with your given type I think you're looking for something like:<br>
><br>
>> func f1 f2 x = (f1 x) || (f2 x)<br>
><br>
> I'm sure there is a nice way to do this with function composition but<br>
> I still find composition less intuitive than explicit args in cases<br>
> like this.<br>
><br>
> On Sun, Apr 18, 2010 at 1:00 PM, Mujtaba Boori <<a href="mailto:mujtaba.boori@gmail.com">mujtaba.boori@gmail.com</a>> wrote:<br>
>> Thanks for helping me but I have another problem (sorry for asking) . I<br>
>> tried to figure it out .<br>
>> how about if I want to compare two kind with (&&) (||) for<br>
>> func :: (a -> Bool) -> (a -> Bool) -> (a -> Bool)<br>
>><br>
>> I tried some thing like<br>
>> func = ((||) .)<br>
>> This is the annoying part about Haskell . I can not understand composition .<br>
>><br>
>> On Sun, Apr 18, 2010 at 4:35 PM, Mujtaba Boori <<a href="mailto:mujtaba.boori@gmail.com">mujtaba.boori@gmail.com</a>><br>
>> wrote:<br>
>>><br>
>>> Hello I am kinda newbie in Haskell you can help help me with some<br>
>>> programming<br>
>>> I am trying to make function like for example<br>
>>> func :: (a -> Bool) -> (a -> Bool)<br>
>>> this function make calculation and return bool . I want to be able to<br>
>>> make bool True when It is False and False when it is True while returning<br>
>>> the a.<br>
>>> Thank you<br>
>>> --<br>
>>> Mujtaba Ali Alboori<br>
>><br>
>><br>
>><br>
>> --<br>
>> Mujtaba Ali Alboori<br>
>><br>
>> _______________________________________________<br>
>> Haskell-Cafe mailing list<br>
>> <a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
>> <a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
>><br>
>><br>
><br>
><br>
><br>
> --<br>
> <a href="http://keithsheppard.name" target="_blank">keithsheppard.name</a><br>
> _______________________________________________<br>
> Haskell-Cafe mailing list<br>
> <a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
> <a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Mujtaba Ali Alboori<br>
</div></div></div>