Reputation: 53856
Is this the correct way to describe a function specification and definition
MagicHaskeller generates a function given a specification.
For example the specification : f [ 3 , 4 , 5.6 ] ~= 4.2
generates the function f = (\a b -> sum a / 3)
Put another way : the function : f [ 3 , 4 , 5.6 ] ~= 4.2
accepts a list of three values and generates an approximate value by applying a transformation to these list values. The function generated f = (\a b -> sum a / 3)
takes a function a which sums the list values and divides by 3. I think the statement takes a function a which sums the list values and divides by 3
is incorrect. What is the correct interpretation of the function f = (\a b -> sum a / 3)
?
Is my terminology correct ?
Upvotes: 0
Views: 113
Reputation: 72044
Not quite, but close.
f
is a function (it's a name bound to a lambda expression) that takes two arguments: a list of numbers a
and some b
that is completely ignored. The function returns the sum of the numbers in the list divided by three.
Upvotes: 1