Hi everyone, I need help in Haskell coding to please only Haskell code, Regards
Consider this function:
applyThrice f x = f (f (f x))
this function takes a unary function: for example:
>applyThrice (+2) 2
8
use ., the function composition operator, and/or $, the function application operator, to make this function more readable
The Haskell language provides us with 2 operators, the function
composition operator (.) and the application operator ($).
The two operators can be understood with this simple schematic:
For infix operator $, the left operand should be a function of
the type a -> b, the right operand becomes the value on which
the function is to be applied. In laymen's terms, if a then get the
results for b.
For . both the operands are functions with their return value being
a function too. We can use composition to chain many functions to
get a final function which accepts the operand, this way, the final
function obtained can be used as the left operand for the
application operator $.
Now to composite the given function we can proceed as
follows:
First looking at the innermost f x:
Here we have a function f which accepts one argument. Since we
don't know the type let's assume x has type 'a', so a: x::a.
Thus we can say f accepts a value of type 'a', a: f :: a -> _,
let this new unknown type be 'b', thus, we arrive at -
b: f :: a -> b.
So f x would be of type b.
But, we have f(f x) and the input for f is of type ' a'. Thus we
can conclude that a and b are actually the same type.
So, we get f:: a -> a. The same can be said for f(f(f x ).
Concurring to this we can say that our functions accept several
parameters despite each function actually taking only one parameter
and returning partially applied functions until we reach the final
function that returns a solid value.
Thus we can rearrange our function for composition as :
applyThrice f = f . f . f $ x
Hi everyone, I need help in Haskell coding to please only Haskell code, Regards Consider this...
Hi everyone, I need help In Haskell Coding. Please code in Haskell, Regards 1) Write a function that takes a list of tuples of three integers each and returns a list consisting of just the tuples that are Pythagorean triples. instead of using a list comprehension, use lambda expression and a function that tests one tuple and returns a Bool. As long as the lambda expression is correct, it is OK to make this simpler by having the lambda calls...
Hi everyone, I need help in Haskell, please. Write a Haskell function that takes an Int i as its only parameter and uses a list comprehension to caclulate m(i) = 1 + 1/2 + 1/3, ... + 1/i
hi everyone, this is a biochemistry question I need help with
explaining. Please show/explain your steps or work,
thank you in advance!
B) Outline a known moonlighting function of one of the enzymes of the TCA. C) Outline how the TCA is regulated.
Hi, I need some help writing matlab code for the conversion of a greyscale image to 8-bit per pixel greyscale, using block truncation coding. Can someone please provide some code for me to use?
Hi everyone! I need help on my Java assignment. I need to create a method that is called sumIt that will sum two values and will return the value.It should also invoke cubeIt from the sum of the two values. I need to change the currecnt program that I have to make it input two values from the console. The method has to be called sumIt and will return to the sum that will produce the cube of the sum...
Hi guys, i need the coding, please help me. (Must using
KEIL uversion software). TQ
Write a coding for Counter to count from 00 until 99 (in decimal). Display the result at 2 BCD 7- segment attached to address 0x20000000 and 0x20000001.
Hey everyone! I need help finishing this homework please. I also
need the work. Thank you!!
For #11 20, compute(x+h) f(x) Simplify. 11 f(x)x- 2 11 Г() - Nx 12. 12 13. f(х) — 4—3х 13 f(x) %3 Зx? + 6х 14 14. F(x) — х* 15. 15.
Hi I need help on C++ coding hw Q! thank you!
Q4 6 Points List 3 things that are wrong with the following code: int *n - new int; // line 1 bool x - false; // line 2 bool *b; // line 3 int *p - n; // line 4 *b- true; // line 5 delete ni // line 6 b- &x; // line 7 delete bi // line 8 delete : // line 9 Please reference the line...
Hi, I need help writing a code for this. The language is python 3, and we cannot use things like break, continue, exit(), lambda, map, filter, raise, try, except, and assert in our code. Thank you! We must write a function called "binary_to_decimal(binary_number)" that takes a string for a binary number and output the decimal integer for that number. The solution, aka the code, MUST contain a for loop of this form (power is an integer variable you define earlier):...
Hi I need some help writing a security code using python mongodb restful api. I just need help on how to provide a security login to user to enter their username and password or to have a block in using extra access once they have logined and they want more access to the databases they will be force to sign out of the server but I just do not know how to start on it can someone show me how...