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.