File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -36,11 +36,17 @@ const baseBuiltInDiffFunc =
3636 Effect . flatMap ( ( diffFn ) =>
3737 Match . value ( diffFn ) . pipe (
3838 Match . when ( "sin" , ( ) =>
39- Effect . succeed (
40- CallObj . make ( {
41- fn : BuiltInObj . make ( { fn : "cos" } ) ,
42- args,
43- } ) ,
39+ Schema . decodeUnknown ( PolynomialObj ) ( args [ 0 ] ) . pipe (
40+ Effect . flatMap ( ( g ) =>
41+ chainRule (
42+ CallObj . make ( {
43+ fn : BuiltInObj . make ( { fn : "cos" } ) ,
44+ args,
45+ } ) ,
46+ g ,
47+ x ,
48+ ) ,
49+ ) ,
4450 ) ,
4551 ) ,
4652 Match . when ( "cos" , ( ) =>
Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ import type { Obj } from "@/schemas/objs/union";
1818import { PolynomialObj } from "@/schemas/objs/unions/polynomials" ;
1919import { fnTokenSchema } from "@/schemas/token/function-literal" ;
2020import { Effect , Either , Match , Schema } from "effect" ;
21- import { left } from "effect/Either" ;
2221import type { ParseError } from "effect/ParseResult" ;
2322import type { KennethParseError } from "src/errors/kenneth/parse" ;
2423import type { DiffExp } from "src/schemas/nodes/exps/diff" ;
@@ -138,7 +137,9 @@ const nodeEvalMatch = (env: Environment) =>
138137 Schema . decodeUnknownEither ( BuiltInDiffObj ) ( fnEval ) ;
139138
140139 return yield * Either . isRight ( either ) && identoverlap
141- ? Effect . succeed ( CallObj . make ( { fn : either . right , args } ) )
140+ ? Effect . succeed (
141+ CallObj . make ( { fn : either . right , args : argsEval } ) ,
142+ )
142143 : applyFunction ( obj ) ( argsEval ) ;
143144 } ) ,
144145 ) ,
You can’t perform that action at this time.
0 commit comments