<p>The first two arguments to your function are not typed as lists in the binding. </p>
<p>[Float] is a list of floats. (Float) is not.</p>
<div class="gmail_quote">On 5 Feb 2012 15:57, "Thomas Engel" <<a href="mailto:thomas.engel1@gmx.net">thomas.engel1@gmx.net</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello Henk-Jan,<br>
> ><br>
><br>
> The line<br>
> >integriereListe [][] = [0.0]<br>
> should be<br>
> >integriereListe [][] = 0.0<br>
> as the line below that calculates a number, not a list of numbers<br>
> (that is, the type is different for that line).<br>
thanks for the hint. I have changed the function accordingly but there is still an error for the types.<br>
<br>
integriereListe::(Float)->(Float)->(Float)<br>
integriereListe [][] = 0.0<br>
integriereListe (x:xs) (y:ys) = (y - y2) /2 * (x2 -x)<br>
where<br>
x2 = head xs<br>
y2 = head ys<br>
<br>
Couldn't match expected type `Float' with actual type `[t0]'<br>
In the pattern: x : xs<br>
In an equation for `integriereListe':<br>
integriereListe (x : xs) (y : ys)<br>
= (y - y2) / 2 * (x2 - x)<br>
where<br>
x2 = head xs<br>
y2 = head ys<br>
<br>
This are my first steps in haskell. I don't know whether my first basic approach is OK or is there a better solution for this calculation?<br>
There is no formula to map over a list and integrate, I only have two list with values. I can zip the lists together to have a list of tuples if this is an advantage.<br>
What I need is the first and the second value from each list, do the calculation,<br>
the second value will become the first value of the next calculation and so on until the end of the lists.<br>
I also need the result of the last calculation to add to the current calculation.<br>
<br>
My calculation in excel with VBA is working, but it's quite difficult for me to do this with functional programming.<br>
<br>
Any hints are welcome!<br>
<br>
Thomas<br>
<br>
<br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
</blockquote></div>