Applying a function with multiple inputs using Map? (Haskell)
Posted
by Schroedinger
on Stack Overflow
See other posts from Stack Overflow
or by Schroedinger
Published on 2010-05-16T09:11:41Z
Indexed on
2010/05/16
9:20 UTC
Read the original article
Hit count: 247
G'day guys,
Trying currently to finish up a bit of homework I'm working on, and having an issue where I'm trying to apply map across a function that accepts multiple inputs.
so in the case I'm using processList f (x:xs) = map accelerateList f xs x xs
processList is given a floating value (f) and a List that it sorts into another List
Accelerate List takes a floating value (f) a List and a List Object through which it returns another List Object
I know my Accelerate List code is correct, but I cannot for the life of me get the syntax for this code working:
processList :: Float -> [Object] -> [Object]
accelerate f [] = []
accelerate f [x] = [(accelerateForce f x x)]
accelerate f (x:xs) = map accelerateList f xs x xs
Any ideas? I've been scratching my head for about 3 hours now. I know it's something really simple.
© Stack Overflow or respective owner