<div dir="ltr">Thanks Dan. Great help <div><br></div><div>but my problem has not solved yet</div><div>This doesn't work for type (<span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">(Float -> Float)->Bool)</span></div>
<div><br></div><div>to make it easier ignore the rotation and suppose I want just multiplay with whatever (x ,y) and return the result to this type (<span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">(Float -> Float)->Bool)</span></div>
<div><br></div><div><div>note this type is shorten and replace by t</div><div>Type Point = (Float, Float)</div><div>Type Bitmap = Point -> Bool</div><div><br></div><div>so the function type actually</div><div>func :: Bitmap -> Float -> Bitmap</div>
<div><br></div><div>I want to take Bitmap do some calculation on Bitmap the return it as Bitmap.</div><div><br></div><div>GHCi response for Dan method is this </div><div><div> Couldn't match expected type `Bitmap'</div>
<div> against inferred type `(a, b)'</div><div>so it is missing a Bool.</div></div><div><br></div><div>hopefully it is clear .</div></div><div><br></div><div>On Mon, Apr 19, 2010 at 7:02 PM, Dan Weston <span dir="ltr"><<a href="mailto:westondan@imageworks.com">westondan@imageworks.com</a>></span> wrote:</div>
<div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">First of all, your function </blockquote><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im"><br>
func (x,y) s dg =((x*(cos dg) - y*(sin dg)),(x*(sin dg) - y*(cos dg)))<br></div>
does NOT work for type (Float -> Float), unless you mean that that is the type of the unused parameter s. Also, your desired type ((Float -> Float) -> Bool) itself looks suspicious. It must accept any function (without something to apply it to) and arbitrarily return True or False. How will you decide which? I suspect you need another parameter for this function.<br>
<br>
Second, on the off chance you are trying to calculate the position on a circle scaled then rotated an angle dg from (x,y), that new position is<br>
<br>
f (x,y) s dg = (s*(x*(cos dg) - y*(sin dg)),s*(x*(sin dg) + y*(cos dg)))<br>
<br>
in which case you are missing the s and the last minus sign in your formula should be a plus sign.<br>
If so, this can be evaluated with greater clarity (and probably accuracy) in polar coordinates:<br>
<br>
g (x,y) s dg = (r * cos a, r * sin a)<br>
where r = s * sqrt (x^2 + y^2)<br>
a = atan2 y x + dg<br>
<br>
Third, if you did not need the scale, I would use an underscore to make that clear:<br>
<br>
h (x,y) _ dg = (r * cos a, r * sin a)<br>
where r = sqrt (x^2 + y^2)<br>
a = atan2 y x + dg<br>
<br>
That's all the observations I can make unless you describe the problem more clearly. Sorry.<br>
<br>
Dan<br>
<br>
Mujtaba Boori wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
sorry <br>
ok I am trying to make these calculation <br>
func (x,y) s dg =((x*(cos dg) - y*(sin dg)),(x*(sin dg) - y*(cos dg)))<br>
<br>
This work for type (Float -> Float)<br>
<br>
but how can make it work with ((Float -> Float) -> Bool)<br>
<br>
because my main function that I want use with. it takes (Float,Float) ->Bool) I need to return the same type ((Float,Float) ->Bool) so it could be used with other function. <br>
<br></div><div class="im">
On Mon, Apr 19, 2010 at 5:54 PM, Ozgur Akgun <<a href="mailto:ozgurakgun@gmail.com" target="_blank">ozgurakgun@gmail.com</a> <mailto:<a href="mailto:ozgurakgun@gmail.com" target="_blank">ozgurakgun@gmail.com</a>>> wrote:<br>
<br>
Can you at least give an example of how you intend to use this "func"?<br>
Since you do not describe it's behaviour, it is very hard to make a<br>
useful<br>
comment (at least for me)<br>
<br>
Best,<br>
<br>
On 19 April 2010 16:54, Mujtaba Boori <<a href="mailto:mujtaba.boori@gmail.com" target="_blank">mujtaba.boori@gmail.com</a><br></div><div class="im">
<mailto:<a href="mailto:mujtaba.boori@gmail.com" target="_blank">mujtaba.boori@gmail.com</a>>> wrote:<br>
><br>
> Hello<br>
> I am sorry for the silly question.<br>
><br>
> I have a function as the following<br>
> func:: ((Float,Float) ->Bool) -> Float -> ((Float,Float) -> Bool)<br>
> I am trying to make calculation in this type ((Float,Float)<br>
->Bool) with Float and then pass the information to ((Float,Float)<br>
-> Bool)<br>
><br>
> Thank again appreciated.<br>
> _______________________________________________<br>
> Haskell-Cafe mailing list<br></div>
> <a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a> <mailto:<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a>><div class="im"><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>
Ozgur Akgun<br>
<br>
<br>
<br>
<br>
-- <br>
Mujtaba Ali Alboori<br>
<br>
</div></blockquote>
</blockquote></div><br><br clear="all"><br>-- <br>Mujtaba Ali Alboori<br>
</div></div>