[Haskell-beginners] help with lists and tuples

Miro Karpis miroslav.karpis at gmail.com
Mon Apr 15 01:04:02 CEST 2013


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20130415/f1b34947/attachment.htm>


More information about the Beginners mailing list