Re: Fusion Laws?
Michael Haufe <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.jseng |
|---|---|
| Message-ID | <[email protected]> |
On Wednesday, March 30, 2016 at 4:48:36 PM UTC-5, Boris Zbarsky wrote:
> On 3/30/16 5:02 PM, Michael Haufe wrote:
> > For example:
> >
> > xs.map(f).map(g) <==> xs.map(g ∘ f)
>
> This transformation is only valid if f and g can be proved to have no
> side-effects, yes?
In general yes. The exceptions are of course idempotent ones like dom calls which are constant after creation (window.self perhaps?), and innocuous side-effects that are never used:
xs.map(function(x){
var d = Date.now(); //side-effect
var r = Math.random(); //side-effect
return x
});
_______________________________________________
dev-tech-js-engine mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine