So, I have this function defined in an org mode file:
<code>#+name: index
#+begin_src emacs-lisp :var s="" n=1
(let ((str (upcase (s-replace-regexp "[^A-Za-z]" "" s))))
(substring str (1- n) n))
#+end_src
</code>
<code>#+name: index
#+begin_src emacs-lisp :var s="" n=1
(let ((str (upcase (s-replace-regexp "[^A-Za-z]" "" s))))
(substring str (1- n) n))
#+end_src
</code>
#+name: index
#+begin_src emacs-lisp :var s="" n=1
(let ((str (upcase (s-replace-regexp "[^A-Za-z]" "" s))))
(substring str (1- n) n))
#+end_src
I have a simple table:
<code>| Word | Number | Letter |
|------+--------+--------|
| Foo | 1 | |
| Bar | 2 | |
| Baz | 1 | |
| Quux | 3 | |
</code>
<code>| Word | Number | Letter |
|------+--------+--------|
| Foo | 1 | |
| Bar | 2 | |
| Baz | 1 | |
| Quux | 3 | |
</code>
| Word | Number | Letter |
|------+--------+--------|
| Foo | 1 | |
| Bar | 2 | |
| Baz | 1 | |
| Quux | 3 | |
I want to set each cell in the column “Letter” to the result of calling “index” with the corresponding Word and Letter values.
I tried the following, but it didn’t work. It just gave me “#ERROR” in the 3rd column:
#+TBLFM: $3='(org-sbe index (s $$1) (n $2))