From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: pure-fns in byte-opt.el Date: Tue, 25 Jul 2017 17:27:31 -0400 Message-ID: References: <20170725020650.GA12601@holos.localdomain> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1501018200 22539 195.159.176.226 (25 Jul 2017 21:30:00 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 25 Jul 2017 21:30:00 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Philipp Stephani Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jul 25 23:29:56 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1da7Op-0005VP-CT for ged-emacs-devel@m.gmane.org; Tue, 25 Jul 2017 23:29:51 +0200 Original-Received: from localhost ([::1]:34733 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1da7Ov-0004Iz-3K for ged-emacs-devel@m.gmane.org; Tue, 25 Jul 2017 17:29:57 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49467) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1da7Mg-0002ze-Fk for emacs-devel@gnu.org; Tue, 25 Jul 2017 17:27:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1da7Md-0003gc-Bg for emacs-devel@gnu.org; Tue, 25 Jul 2017 17:27:38 -0400 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]:47401) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1da7Md-0003ff-5e for emacs-devel@gnu.org; Tue, 25 Jul 2017 17:27:35 -0400 Original-Received: from ceviche.home (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id v6PLRVFe013470; Tue, 25 Jul 2017 17:27:31 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id 8E01A660F2; Tue, 25 Jul 2017 17:27:31 -0400 (EDT) In-Reply-To: (Philipp Stephani's message of "Tue, 25 Jul 2017 20:57:58 +0000") X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 2 Rules triggered EDT_SA_DN_PASS=0, RV6079=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6079> : inlines <5993> : streams <1755758> : uri <2469776> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.20 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:217027 Archived-At: > 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) (progn (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'). Stefan