From: Marc-Oliver Ihm <marc-oliver.ihm@online.de>
Cc: emacs-orgmode@gnu.org
Subject: Re: [babel] Code for simple set-operations on two tables. Asking for some input.
Date: Wed, 28 Dec 2011 09:56:17 +0100 [thread overview]
Message-ID: <4EFAD9B1.2070902@online.de> (raw)
In-Reply-To: <87sjk5ka7s.fsf@gmx.com>
Am 27.12.2011 21:53, schrieb Eric Schulte:
> Marc-Oliver Ihm<marc-oliver.ihm@online.de> writes:
>
>> Hello,
>>
>> Please find attached the elisp-file and a tutorial (as an org-file) for org-babel-table-proc.
>>
>> It provides some simple set-operations (mostly merge and intersect),
>> which treat org-mode tables as sets.
>>
>> An example for merging two tables would be:
>>
>>> #+name: lower
>>> | 2 | b |
>>> | 4 | d |
>>> | 5 | e |
>>> | 6 | h |
>>>
>>> #+name: upper
>>> | 1 | A |
>>> | 3 | C |
>>> | 4 | D |
>>> | 10 | J |
>>> | 2 | B |
>>>
>>> #+begin_src emacs-lisp :var t1=lower :var t2=upper
>>> (babel-table-proc-merge t1 t2)
>>> #+end_src
>>>
>>> #+results:
>>> | 1 | | A |
>>> | 2 | b | B |
>>> | 3 | | C |
>>> | 4 | d | D |
>>> | 5 | e | |
>>> | 6 | h | |
>>> | 10 | | J |
>>
>> which merges the two input tables lower and upper into a single table,
>> even, if they do not have all keys (from the first column) in common.
>> In general this merges information from two different sources without
>> loosing anything.
>>
>> The package org-babel-table-proc provides these and a few other
>> operations, but definitely still needs some debugging and polishing.
>>
>> However, before finishing this work, I would like to ask, if something
>> like this is already present in babel or the library of babel ?
>>
>
> Nothing like this is currently available in the library of Babel. I do
> think that such a library of "indexed set operations" would be a useful
> addition to the library. As for packaging, although it may be more
> comfortable to develop these functions in the manner you are currently
> using (with side-by-side .el and .org files), when it comes time to add
> these code blocks to the library of babel, I would recommend *combining*
> the elisp source and the explanatory prose as a single new subtree in
> the existing org-babel-library-of-babel.org file.
>
> Rather than exposing these functions as elisp functions they could be
> exposed as Babel code blocks, e.g.,
>
> #+begin_src emacs-lisp :var t1=lower :var t2=upper
> (babel-table-proc-merge t1 t2)
> #+end_src
>
> would instead become
>
> #+call: proc-merge(lower, upper)
>
>>
>> Also, I am not sure, which prefix to use for packages and functions;
>> is org-babel-table-proc the right name or can it be shortened to
>> ob-table-proc.
>>
>
> If you package these as code blocks in the library of babel then there
> is no issue of prefixing, just pick meaningful names for the code blocks
> and don't define any global elisp functions.
>
>>
>> Any input would be very welcome !
>>
>
> I hope the above helps, please let me know if I have been unclear or if
> you have any other questions.
>
> I look forward to your patch!
>
> Cheers,
>
>>
>> With kind regards, Marc-Oliver Ihm
>>
>>
>
Hi Eric,
Thanx, that was exactly the input I was looking for.
Now I have something nice to code over the vacations :-)
I will try to merge it all into the existing library without using global functions and come back with a patch ...
with kind regards, Marc-Oliver Ihm
next prev parent reply other threads:[~2011-12-28 8:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-26 11:00 [babel] Code for simple set-operations on two tables. Asking for some input Marc-Oliver Ihm
2011-12-27 20:53 ` Eric Schulte
2011-12-28 8:56 ` Marc-Oliver Ihm [this message]
2012-01-14 9:27 ` Marc-Oliver Ihm
2012-01-15 16:10 ` Eric Schulte
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4EFAD9B1.2070902@online.de \
--to=marc-oliver.ihm@online.de \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).