Timeline for Golf the xᵗʰ root of x
Current License: CC BY-SA 3.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 17, 2020 at 9:04 | history | edited | CommunityBot |
Commonmark migration
|
|
Mar 2, 2016 at 16:54 | comment | added | nimi | @Neil: yes. | |
Mar 2, 2016 at 13:03 | comment | added | Neil |
@nimi So it's the equivalent of the S combinator i.e. S(**)(1/)?
|
|
Feb 24, 2016 at 16:52 | comment | added | nimi |
The function <*> takes 3 arguments, two functions f and g and an argument x . It is defined as (<*>) f g x = f x (g x) , i.e. it applies f to x and g x . Here it's partially applied to f and g leaving out x , where f = (**) and g = (1/) (another partially applied function (a section) that calculates the reciprocal value of it's argument). So ( (**)<*>(1/) ) x is (**) x ((1/) x) or written in infix: x ** ((1/) x) and with the section resolved: x ** (1/x) . -- Note: <*> is used in function context here and behaves differently in other contexts.
|
|
Feb 24, 2016 at 16:43 | comment | added | MathematicalOrchid |
This uses the fact that a 1-argument function can be considered an applicative functor (the "reader monad"). The <*> operator takes an applicative that produces a function, and an applicative that produces a value, and applies the function to the value. So in this case, a mind-bending way to apply a 2-argument function to a 1-argument function.
|
|
Feb 24, 2016 at 9:03 | history | edited | flawr | CC BY-SA 3.0 |
added 94 characters in body
|
Feb 24, 2016 at 9:02 | comment | added | flawr | @LambdaFairy Thanks! Do you mind explaining? It looks like you are doing some magic with partially applied functions but as I am quite new to Haskell I do not really understand how this works=) | |
Feb 24, 2016 at 1:32 | comment | added | Lambda Fairy |
(**)<*>(1/) is 11 bytes.
|
|
Feb 23, 2016 at 22:20 | review | Low quality posts | |||
Feb 23, 2016 at 22:55 | |||||
Feb 23, 2016 at 22:05 | history | answered | flawr | CC BY-SA 3.0 |