Marc-Oliver Ihm <marc-oliver....@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 > > -- Eric Schulte http://cs.unm.edu/~eschulte/