From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marc-Oliver Ihm Subject: Re: [babel] Code for simple set-operations on two tables. Asking for some input. Date: Wed, 28 Dec 2011 09:56:17 +0100 Message-ID: <4EFAD9B1.2070902@online.de> References: <87sjk5ka7s.fsf@gmx.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([140.186.70.92]:46338) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RfpJO-0007DJ-Tr for emacs-orgmode@gnu.org; Wed, 28 Dec 2011 03:56:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RfpJN-0006Pg-Gx for emacs-orgmode@gnu.org; Wed, 28 Dec 2011 03:56:38 -0500 Received: from lo.gmane.org ([80.91.229.12]:38161) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RfpJM-0006Pa-Ur for emacs-orgmode@gnu.org; Wed, 28 Dec 2011 03:56:37 -0500 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1RfpJJ-0003AU-5K for emacs-orgmode@gnu.org; Wed, 28 Dec 2011 09:56:33 +0100 Received: from p54a885df.dip0.t-ipconnect.de ([84.168.133.223]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 28 Dec 2011 09:56:33 +0100 Received: from marc-oliver.ihm by p54a885df.dip0.t-ipconnect.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 28 Dec 2011 09:56:33 +0100 In-Reply-To: <87sjk5ka7s.fsf@gmx.com> 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Cc: emacs-orgmode@gnu.org Am 27.12.2011 21:53, schrieb Eric Schulte: > Marc-Oliver Ihm 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