From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jarmo Hurri Subject: Re: Preserving the geometry of a table range Date: Sun, 26 Aug 2012 11:45:50 +0300 Message-ID: <87harq59dt.fsf@syk.fi> References: <87lih25ejt.fsf@syk.fi> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([208.118.235.92]:34082) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T5YYb-0007Vh-W1 for emacs-orgmode@gnu.org; Sun, 26 Aug 2012 04:50:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T5YYb-0006nJ-0v for emacs-orgmode@gnu.org; Sun, 26 Aug 2012 04:50:57 -0400 Received: from plane.gmane.org ([80.91.229.3]:51192) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T5YTt-0005oR-49 for emacs-orgmode@gnu.org; Sun, 26 Aug 2012 04:46:05 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1T5YTq-0003Ji-VN for emacs-orgmode@gnu.org; Sun, 26 Aug 2012 10:46:02 +0200 Received: from cs181237063.pp.htv.fi ([82.181.237.63]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 26 Aug 2012 10:46:02 +0200 Received: from jarmo.hurri by cs181237063.pp.htv.fi with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 26 Aug 2012 10:46:02 +0200 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 To: emacs-orgmode@gnu.org Greetings Michael. I can try. Here is an example of the desired low-level functionality with a simple function. The lookup functions would be built on this. Does this help? * an example of low level functionality Here is an example of an elisp function working on a range as a list of rows. This one first finds the product of the elements on each row, and then sums up these products. #+BEGIN_SRC emacs-lisp (defun sum-row-prods (rows) (apply '+ (mapcar (lambda (row) (apply '* row)) rows))) #+END_SRC #+RESULTS: : sum-row-prods Then here we have a table in which the element at @4$1 is given by applying the function sum-row-prods to a specific list of lists. This works already in org mode, since in the formula for @4$1 the list of lists is given as a constant. The formula for @4$2 illustrates the desired functionality, that is, being able to apply the function sum-row-prods to range @2$1..@3$2. The result should be #+BEGIN_SRC emacs-lisp (sum-row-prods '((2 3) (4 5))) #+END_SRC #+RESULTS: : 26 but now it naturally gives an error, since the argument to sum-row-prods is a list, not a list of lists (rows). | a | b | |----+--------| | 2 | 3 | | 4 | 5 | | 10 | #ERROR | #+tblfm: @4$1='(sum-row-prods '((-4 1) (-2 -7)));N::@4$2='(sum-row-prods '(@2$1..@3$2));N I don't know what the new syntax for referring to a range as a list of rows should look like. -- Jarmo