From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: `thunk-let'? Date: Fri, 24 Nov 2017 10:36:20 +0200 Message-ID: <83shd49ipn.fsf@gnu.org> References: <87infp9z6j.fsf@web.de> <87zi90eehg.fsf@web.de> <87o9ocd6s4.fsf@web.de> <87wp2zcwm2.fsf@web.de> <87mv3vwb2c.fsf_-_@web.de> <87h8tnowl4.fsf@web.de> <83vai3asgt.fsf@gnu.org> <83mv3eb85m.fsf@gnu.org> <87a7zdbsyf.fsf@web.de> <873755hbpr.fsf@web.de> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1511512646 32623 195.159.176.226 (24 Nov 2017 08:37:26 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 24 Nov 2017 08:37:26 +0000 (UTC) Cc: emacs-devel@gnu.org To: Michael Heerdegen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 24 09:37:22 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 1eI9U6-000806-PK for ged-emacs-devel@m.gmane.org; Fri, 24 Nov 2017 09:37:18 +0100 Original-Received: from localhost ([::1]:47985 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eI9UD-0006ef-Sn for ged-emacs-devel@m.gmane.org; Fri, 24 Nov 2017 03:37:25 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45927) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eI9TX-0006Kn-6H for emacs-devel@gnu.org; Fri, 24 Nov 2017 03:36:49 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eI9TT-0004LI-V2 for emacs-devel@gnu.org; Fri, 24 Nov 2017 03:36:43 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:55868) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eI9TT-0004Kz-Rz; Fri, 24 Nov 2017 03:36:39 -0500 Original-Received: from [176.228.60.248] (port=2605 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1eI9TT-00033b-4B; Fri, 24 Nov 2017 03:36:39 -0500 In-reply-to: <873755hbpr.fsf@web.de> (message from Michael Heerdegen on Thu, 23 Nov 2017 05:15:44 +0100) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e 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:220419 Archived-At: > From: Michael Heerdegen > Cc: emacs-devel@gnu.org > Date: Thu, 23 Nov 2017 05:15:44 +0100 > > Michael Heerdegen writes: > > > This helped a lot. My first version even compiled without error. I'll > > post the updated patch soon. > > Ok, here is what I have, with everything discusses included (see also > attached). I will proofread it once more, maybe others will want to > have a look in the meantime, too. My comments below. > +@defmac thunk-delay forms... Please use "forms@dots{}" instead, it produces a prettier ellipsis. > +Return a thunk for evaluating the @var{forms}. A thunk is a closure > +that evaluates the @var{forms} in the lexical environment present when > +@code{thunk-delay} had been called. This could be improved as follows: @cindex thunk Return a @dfn{thunk} for evaluating the @var{forms}. A thunk is a closure (@pxref{Closures}) that evaluates the @var{forms} in the lexical environment present when @code{thunk-delay} had been called. The improvements are: . you introduce a new term, so it should be in @dfn, and an index entry for it is in order . you mention "closures", so a cross-reference to where these are described is a Good Thing, because the reader might not know or remember what that is > +@code{thunk-delay} had been called. "had been called" or "will be called"? > +@defun thunk-force thunk > +Force @var{thunk} to perform the evaluation of the forms specified to the > +@code{thunk-delay} that created the thunk. "to the thunk-delay" or "in the thunk-delay" (or "for the thunk-delay")? > +of the last form is returned. The @var{thunk} also "remembers" that it has Quoting in Texinfo is ``like this'' (I guess you didn't use the Emacs Texinfo mode, or typed `C-q "' here.) makeinfo will then convert these to the actual quote characters. > +been forced: Any further calls of @code{thunk-force} on the same @var{thunk} ^^ "with" > +@defmac lazy-let (bindings...) forms... @dots{} again > +This macro is analogous to @code{let} but creates "lazy" variable ``lazy''. > +bindings. Any binding has the form (@var{symbol} @var{value-form}). The entire parenthesized expression should be in @code: @code{(@var{symbol} @var{value-form})} I also recommend to wrap that in @w, so that it doesn't get split between two lines, like this: @w{@code{(@var{symbol} @var{value-form})}} > +@group > +(f 12) > +@print{} "Calculating 1 plus 2 times 12" > +25 This 25 should have @result{} before it, right? > +to set them (e.g.@ with @code{setq}). You mean "e.g.@:", right? > +@defmac lazy-let* (bindings...) forms... @dots{} > +binding expressions. All references to the original variables in the > +body @var{forms} are then replaced by an expression that calls > +@code{thunk-force} on the according helper variable. So, any code "calls ... on" is slightly awkward English, I think. How about "calls thunk-force passing it the according helper variable as an argument", or calls thunk-force with the according helper variable as the argument" instead? > +** Thunk > +*** The new macros 'thunk-let' and 'thunk-let*' are analogue to `let' > +and `let*' but create bindings that are evaluated lazily. I think this should be a single-level entry: ** New macros 'thunk-let' and 'thunk-let*'. These macros are analogue to `let' and `let*', but create bindings that are evaluated lazily. Thanks again for working on this.