DEV Community

Discussion on: Debounce and Throttle

Collapse
 
iquardt profile image
Iven Marquardt

Since you tagged your post #functional: The way you implemented both functions they are not really functions but impure actions. In a functional setting you would further defer effect execution after passing args by wrapping the result in a special effect or IO type. Then you can compose values of this type in a purely functional manner and only unleash the composed effects at the edge of your application.

Collapse
 
nugetchar profile image
Thomas Toledo-Pierre • Edited

I'll let you explain to the author of the book "Discover Functional Programming in JavaScript", Cristian Salcescu, that his code is impure (since, as I said in my post, the implementations are from his book).