From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dmitrii Korobeinikov Subject: Re: [Proposal] Source Blocks with Post-Extensions Date: Mon, 22 Apr 2019 23:15:34 +0600 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000077ba530587219e5d" Return-path: Received: from eggs.gnu.org ([209.51.188.92]:49135) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hIccX-0001QA-BV for emacs-orgmode@gnu.org; Mon, 22 Apr 2019 13:20:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hIcXj-0004ss-Kc for emacs-orgmode@gnu.org; Mon, 22 Apr 2019 13:15:48 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:40904) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hIcXj-0004sM-BN for emacs-orgmode@gnu.org; Mon, 22 Apr 2019 13:15:47 -0400 Received: by mail-wr1-x433.google.com with SMTP id h4so16542261wre.7 for ; Mon, 22 Apr 2019 10:15:46 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: "Berry, Charles" Cc: emacs-orgmode --00000000000077ba530587219e5d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thank you! That's a handy technique and it does help. As I understand, there's no way to extend that to multiple lines? One-liners for tests are enough sometimes, but not always. For those cases, it is cumbersome to split as well. =D0=BF=D0=BD, 22 =D0=B0=D0=BF=D1=80. 2019 =D0=B3. =D0=B2 22:51, Berry, Char= les : > It looks like you want the :epilogue header argument. See inline. > > > On Apr 22, 2019, at 2:00 AM, Dmitrii Korobeinikov > wrote: > > > > When I write several source blocks, which depend on one another, I tend > to debug them one by one. > > > > So, I write this function and test it: > > > > #+NAME: square > > #+BEGIN_SRC python > > square =3D lambda x: x * x > > return square(5) > > #+END_SRC > > > > #+RESULTS: square > > : 25 > > > > > Equivalently, you could run this: > > #+NAME: square > #+BEGIN_SRC python :epilogue return square(5) > square =3D lambda x: x * x > #+END_SRC > > > > > After I see that the test is successful, I write this client function: > > > > #+BEGIN_SRC python :noweb yes > > <> > > return 5 + square(5) > > #+END_SRC > > > > #+RESULTS: > > : 25 > > > > And here, to get the correct result, I have to remove the ~return > square(5)~ line in ~<>~. > > But I don't want to lose testing! > > S > > With my version of `square`, the epilogue is not included. > > So it works as you want it to. > > HTH, > > Chuck > > > --00000000000077ba530587219e5d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thank you!
That's a handy technique and it does help.
As I unders= tand, there's no way to extend that to multiple lines?
One-li= ners for tests are enough sometimes, but not always.
For those ca= ses, it is cumbersome to split as well.

=D0=BF=D0=BD, 22 =D0=B0=D0=BF= =D1=80. 2019 =D0=B3. =D0=B2 22:51, Berry, Charles <ccberry@ucsd.edu>:
It looks like you want the :epil= ogue header argument. See inline.

> On Apr 22, 2019, at 2:00 AM, Dmitrii Korobeinikov <dim1212k@gmail.com> wrote: >
> When I write several source blocks, which depend on one another, I ten= d to debug them one by one.
>
> So, I write this function and test it:
>
> #+NAME: square
> #+BEGIN_SRC python
>=C2=A0 =C2=A0 =C2=A0square =3D lambda x: x * x
>=C2=A0 =C2=A0 =C2=A0return square(5)
> #+END_SRC
>
> #+RESULTS: square
> : 25
>


Equivalently, you could run this:

#+NAME: square
#+BEGIN_SRC python :epilogue=C2=A0 return square(5)
=C2=A0 =C2=A0 square =3D lambda x: x * x
#+END_SRC



> After I see that the test is successful, I write this client function:=
>
> #+BEGIN_SRC python :noweb yes
>=C2=A0 =C2=A0 =C2=A0<<square>>
>=C2=A0 =C2=A0 =C2=A0return 5 + square(5)
> #+END_SRC
>
> #+RESULTS:
> : 25
>
> And here, to get the correct result, I have to remove the ~return squa= re(5)~ line in ~<<square>>~.
> But I don't want to lose testing!
> S

With my version of `square`, the epilogue is not included.

So it works as you want it to.

HTH,

Chuck


--00000000000077ba530587219e5d--