[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pure-fns in byte-opt.el

From: Stefan Monnier
Subject: Re: pure-fns in byte-opt.el
Date: Tue, 25 Jul 2017 17:27:31 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

> Why? Its return value clearly only depends on its argument, and it doesn't
> change any global state. It's the poster child of a pure function!

  (let ((s (make-string 5 ?a)))
    (list (string-to-char s)
            (aset s 0 ?b)
            (string-to-char s))))

If string-to-char were a pure function, it would return the same value
in both calls (since the arguments are `eq').


reply via email to

[Prev in Thread] Current Thread [Next in Thread]