How to understand curry and function composition using Lodash flow?
问题 import {flow, curry} from 'lodash'; const add = (a, b) => a + b; const square = n => n * n; const tap = curry((interceptor, n) => { interceptor(n); return n; }); const trace2 = curry((message, n) => { return tap((n) => console.log(`${message} is ${n}`), n); }); const trace = label => { return tap(x => console.log(`== ${ label }: ${ x }`)); }; const addSquare = flow([add, trace('after add'), square]); console.log(addSquare(3, 1)); I started by writing trace2 thinking that trace wouldn't work