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: Dmitrii Korobeinikov
Subject: Re: [O] [Proposal] Source Blocks with Post-Extensions
Date: Mon, 22 Apr 2019 23:15:34 +0600

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.

пн, 22 апр. 2019 г. в 22:51, Berry, Charles <address@hidden>:
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]