[Haskell-beginners] help with lists and tuples

Miro Karpis miroslav.karpis at gmail.com
Mon Apr 15 08:11:05 CEST 2013


millions of thanks for all the info.

m.


On Mon, Apr 15, 2013 at 1:21 AM, Paul Higham <polygame at me.com> wrote:

> Wouldn't it do just to have
>
> nActivationSum = map nActivation
>
> or am I missing your intent here?
>
> Note that on the left-hand side of the last equation inputs would have to
> have type (Float, Float) and weights would have to have type
> [(Float,Float)], but on the right-hand side both inputs and weights have to
> be Float.  The result of
> nActivation (inputs, weights) is Float, but the result of
> nActivationSum (inputs:weights) should be [(Float,Float)], hence the error
> message.
>
> :: paul
>
> On 2013-04-14, at 16:04 , Miro Karpis wrote:
>
> Please can you help me with this? What I want is to have on input a list
> of tuple (size 2) and on output list of floats. So now I'm returning only
> float instead of a list. But unfortunately I can't figure out how to
> implement the list......
>
>
> sigmoid :: Float -> Float
> sigmoid x = 1.0 / (1 + exp (-x))
>
> nActivation :: (Float,Float) -> Float
> nActivation (x,y) = sigmoid(x*y)
>
> nActivationSum :: [(Float, Float)] -> [Float]
> nActivationSum [] = []
> nActivationSum (inputs:weights) = *nActivation* (inputs, weights)
>
>
>
> Couldn't match expected type `[Float]' with actual type `Float'
>     In the return type of a call of `nActivation'
>     In the expression: nActivation (inputs, weights)
>     In an equation for `nActivationSum':
>         nActivationSum (inputs : weights) = nActivation (inputs, weights)
>
>
> thanks,
> m.
>  _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20130415/02d15562/attachment-0001.htm>


More information about the Beginners mailing list