From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Max Brieiev Newsgroups: gmane.emacs.bugs Subject: bug#59140: 29.0.50; iter-yield from lambda Date: Sun, 17 Sep 2023 09:32:31 +0300 Message-ID: <87jzsp9uo0.fsf@gmail.com> References: <87sfissyz3.fsf@web.de> <87v8cb9pns.fsf@gmail.com> <87cyyianjg.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31114"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 59140@debbugs.gnu.org, okamsn@protonmail.com, monnier@iro.umontreal.ca To: Michael Heerdegen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Sep 17 08:33:17 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qhlLI-0007xP-TB for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 17 Sep 2023 08:33:16 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qhlKy-00020j-OI; Sun, 17 Sep 2023 02:32:56 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qhlKx-0001yK-De for bug-gnu-emacs@gnu.org; Sun, 17 Sep 2023 02:32:55 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qhlKx-0005b3-4j for bug-gnu-emacs@gnu.org; Sun, 17 Sep 2023 02:32:55 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qhlL4-0006Fa-IC for bug-gnu-emacs@gnu.org; Sun, 17 Sep 2023 02:33:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Max Brieiev Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 17 Sep 2023 06:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59140 X-GNU-PR-Package: emacs Original-Received: via spool by 59140-submit@debbugs.gnu.org id=B59140.169493236924005 (code B ref 59140); Sun, 17 Sep 2023 06:33:02 +0000 Original-Received: (at 59140) by debbugs.gnu.org; 17 Sep 2023 06:32:49 +0000 Original-Received: from localhost ([127.0.0.1]:48908 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhlKr-0006F7-Dy for submit@debbugs.gnu.org; Sun, 17 Sep 2023 02:32:49 -0400 Original-Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]:51394) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhlKp-0006Eu-Mo for 59140@debbugs.gnu.org; Sun, 17 Sep 2023 02:32:48 -0400 Original-Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-9adca291f99so240881366b.2 for <59140@debbugs.gnu.org>; Sat, 16 Sep 2023 23:32:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1694932354; x=1695537154; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=IteOC5kmU9jOGHtlvvTKY9WeHZ2LQtlRvFHIYrYAdLY=; b=D1InTY8kSH4w2ZsEZelpBWnUYuIxhnhUW9q+mOZ+j7FmxTAc4sN81ZfgHZOzTUckXA Y/G1ruABZ/TbfU4UOZyVobSosN0mZPloFIxvqBGtDTG4PAOKolmFpmnTNrprA8kaUVRi R4UbiC6L1BNkWTlfqDqwkG+pJH3szweofEwyNpqAz5of5NeqLW8i2fJVTyURgaOKXlec dUVEo7JZPQXJu7dDUa05hGut8LYUJv5SztZKCUgQfBD5pd38IsIyU5rhLgtbjNEAr4Rd 8B8gzbyF5aXt+D4GmVH3Bj6h2byGtmElAKJPx0W2hlf/y5cR++t9AsShd23hiSPArgFj ubwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694932354; x=1695537154; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=IteOC5kmU9jOGHtlvvTKY9WeHZ2LQtlRvFHIYrYAdLY=; b=G5Gt6Gk3qIhYxprplcUq1kAhn6QFaXP1x1iTMU36bNRYVunHqkFVgMNe/CpCvnltUT 2Cljn6JAJ5bqiXvaJXvUrIEXU6BsSb4q0UF7rQH/3FMuIYmczks9GHiJdCCAtIHHhttX QCcGYV+/iX4tUQWpBC8sHuXcjceRH2SRTFSQCM610cE8/51mh0qSTFiii4nN1vJ1SORu mJAnLm3WQFRIUEgcvtdhxV0MrRM+IqPS+v2h9cRbUtC90NGEsx+yg4Wts33v+fOhV0rq 99GevzVcVZgBYK6FUD30BNmM7GqDTYyo8T+iiIt0OXlCTNf9paK+/zRgFwnckoV35RvI Nb8A== X-Gm-Message-State: AOJu0Yx+26hbuKVziHrHLsBagnvNFEdqdEjdSIyFWnN9qWpmDp0kwcbS IwLKzUY1IKVB/7crdLGPm1PQO4ltxjw= X-Google-Smtp-Source: AGHT+IHgQsrPJHF67JEx1XKFXe/B5teLlN8/W5ikjAOV82SteKkTkGZTsa9puYdH6/zYbqZ3Bfi1gw== X-Received: by 2002:a17:906:73cc:b0:9a5:da6c:6551 with SMTP id n12-20020a17090673cc00b009a5da6c6551mr5539321ejl.62.1694932354232; Sat, 16 Sep 2023 23:32:34 -0700 (PDT) Original-Received: from vmax ([109.251.233.9]) by smtp.gmail.com with ESMTPSA id lj23-20020a170906f9d700b009930c80b87csm4663123ejb.142.2023.09.16.23.32.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Sep 2023 23:32:33 -0700 (PDT) In-Reply-To: <87cyyianjg.fsf@web.de> (Michael Heerdegen's message of "Sat, 16 Sep 2023 03:56:35 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:270668 Archived-At: Michael Heerdegen writes: > Max Brieiev writes: > >> For example, this: >> >> (iter-defun my-generator () >> (funcall (lambda () (iter-yield 5)))) >> >> would be expanded by iter-defun macro into this: >> >> (... >> (let ((gen (iter-lambda () (iter-yield 5)))) >> (iter-next (funcall gen)))) >> >> Does it make sense? > > Does it? Isn't the `let' expression equivalent to just `5'? With other > words: you don't yield from an outside generator, as far as I > understand (or am I wrong? what's the content of your "..."?). > > Michael. You are right, the code is wrong, it should probably return a generator instead. What I attempted to show is how lambda would be turned into `iter-lambda`, conceptually. "..." is some expansion performed by `iter-defun`. In my intuition, if `iter-yield` is encountered inside a lambda, then it would be converted into generator, and then advance the created generator to the first yield expression, such that the following `iter-next` would resume execution from the suspnension point. But I might be wrong, the topic of generators is new to me, and I need to study it.