AutoDiff icon indicating copy to clipboard operation
AutoDiff copied to clipboard

nesting

Open barak opened this issue 7 years ago • 2 comments

*AutoDiff> let shouldBeOne = d (\x -> d (x*) 1) 1
*AutoDiff> shouldBeOne
0

barak avatar Dec 04 '16 10:12 barak

Will look into

friedbrice avatar Dec 05 '16 06:12 friedbrice

Here is how the ad package handles it. And yes, the auto does sort of break the fourth wall of the implementation.

$ cabal install ad
$ ghci
Prelude> :m + Numeric.AD
Prelude Numeric.AD> let d = diff
Prelude Numeric.AD> d (\x -> d (auto x*) 1) 1
1

barak avatar Dec 05 '16 08:12 barak