all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Guido Van Hoecke <guivho@gmail.com>
To: orgmode <emacs-orgmode@gnu.org>, Eric S Fraga <e.fraga@ucl.ac.uk>
Subject: Re: Using constants in columns
Date: Sat, 17 Oct 2015 13:47:06 +0200	[thread overview]
Message-ID: <CAEySM9GUgrDz-_VnaXJ7ZZ_nu7JTMHWgdtWgTK3mv4_LE0mUmw@mail.gmail.com> (raw)
In-Reply-To: <87vba6voyi.fsf@ucl.ac.uk>

[-- Attachment #1: Type: text/plain, Size: 1780 bytes --]

On 16 October 2015 at 16:59, Eric S Fraga <e.fraga@ucl.ac.uk> wrote:

> On Friday, 16 Oct 2015 at 16:38, Guido Van Hoecke wrote:
> > Hi Eric,
> >
> > Thanks for the suggestions, I'll go for the integer value used as an
> index
>
> and please post the index solution for the record?
>

I have not found a way to specify the vector in a constant.
Elisp
​ ​
​needs arrays with space rather than comma as separator, and I can't
​​
find how
​to specify such arrays as constants.

Specifying the vector directly in the formula does work:

#+begin_src org
    |      1 |     0 |    10 |
    |      2 |     1 |   400 |
    |      3 |     2 |  9000 |
  ,#+TBLFM: $3='(* $1 (aref [10 200 3000] $2));N
#+end_src

That is ok if the vector is only to be used in one single formula.

A nicer way is to specify the vector values in named tables and to
reference them 'remotely':

#+begin_src org
  ,#+name: v1
  |10|

  ,#+name: v2
  |200|

  ,#+name: v3
  |3000|


  ,#+name: the table to be computed
  | 5 | v1 |   50 |
  | 2 | v2 |  400 |
  | 3 | v3 | 9000 |
  ,#+TBLFM: $3= $1 * remote($2, @1$1);N
#+end_src

With this solution the values only need to be specified once and can
be used where- and whenever needed.

-- 
Guido

===  ALL USERS PLEASE NOTE  ========================

A new system, the CIRCULATORY system, has been added.

The long-experimental CIRCULATORY system has been released to users.  The
Lisp Machine uses Type B fluid, the L machine uses Type A fluid.  When the
switch to Common Lisp occurs both machines will, of course, be Type O.
Please check fluid level by using the DIP stick which is located in the
back of VMI monitors.  Unchecked low fluid levels can cause poor paging
performance.

[-- Attachment #2: Type: text/html, Size: 2685 bytes --]

  reply	other threads:[~2015-10-17 11:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-16 12:39 Using constants in columns Guido Van Hoecke
2015-10-16 13:48 ` Eric S Fraga
2015-10-16 14:38   ` Guido Van Hoecke
2015-10-16 14:59     ` Eric S Fraga
2015-10-17 11:47       ` Guido Van Hoecke [this message]
2015-10-17 18:00         ` Michael Brand
2015-10-17 20:27           ` Guido Van Hoecke
2015-10-19  6:12             ` Eric S Fraga
2015-10-19  7:13               ` Guido Van Hoecke

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAEySM9GUgrDz-_VnaXJ7ZZ_nu7JTMHWgdtWgTK3mv4_LE0mUmw@mail.gmail.com \
    --to=guivho@gmail.com \
    --cc=e.fraga@ucl.ac.uk \
    --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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.