emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] [Proposal] Source Blocks with Post-Extensions


From: Berry, Charles
Subject: Re: [O] [Proposal] Source Blocks with Post-Extensions
Date: Mon, 22 Apr 2019 16:51:23 +0000

It looks like you want the :epilogue header argument. See inline.

> On Apr 22, 2019, at 2:00 AM, Dmitrii Korobeinikov <address@hidden> 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 = 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 = lambda x: x * x
#+END_SRC



> After I see that the test is successful, I write this client function:
> 
> #+BEGIN_SRC python :noweb yes
>     <<square>>
>     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 ~<<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





reply via email to

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