So i have a function that takes in three variables. Variable y is called by another function that will turn it into a list.
I want to apply map to this list of variables. So that i can recurse through the function using all the elements of the list one at a time.
since this function takes in three variables, and one is a list that i want to recall the function and apply each element of the list until the list is empty. I am not sure how to do this and return the remaining two variables back each time.
search :: State -> Int -> Int -> Int
search state n1 n2 = case n1 of
0 -> 1 * n2
num -> average( map (search s) n1-1 n2)
where s = turnStateToList s
i havent included the turn state to list but i dont think it is required to answer the question. basically it will produce a list of new states. think of it like a tree.
the errors i get are
* map is applied to too many functions
* y has been given arguments however yy takes in 0 arguments
i understand how it is getting these errors however im not sure what else to do to fix it. Ive tried changing up the brackets and that just gives a different argument error.
where y = anotherfunc y
mjakes no sense, since you definey
in terms ofy
, so a recursive definition.func
in practice. (And BTW, don't call functionsfunc
!)