On 22/06/2018 18:48, Nick Dokos wrote: > Uwe Brauer <o...@mat.ucm.es> writes: > >> Hi Jonathan >> >> > Hi Uwe, >> > On Fri, Jun 22, 2018 at 10:16 AM, Uwe Brauer <o...@mat.ucm.es> wrote: >> >> > (::) >> > not just a single. Brent's example has it with double while yours only >> > shows >> > it with a single one. >> >> Right, thanks for clarifying that. My original example had various :: and >> indeed there Bernt's advice helped. >> >> Meanwhile Thierry posted a more sophisticated example containing only >> simple : >> (which does not work with ::) and that example cannot be dealt with via >> C-c '. >> >> @Thierry: that is correct? >> > The double colons separate different formulas. The single colons in Thierry's > formula are part of the syntax of a conditional expression, i.e. they are > part > of a *single* (long) formula. So yes, that cannot be dealt with via C-c '. > A utility lisp function can enhance readability:
#+begin_src elisp (defun test-to-interval (x) (let ((n (string-to-number x))) (cond ((equal x "") "NP") ((and (<= 0 n) (<= n 4.9)) "SS") ((and (<= 5 n) (<= n 6.9)) "AP") ((and (<= 7 n) (<= n 8.9)) "NT") ((and (<= 9 n) (<= n 10 )) "SB") (t "other")))) #+end_src #+TBLNAME: raw-data | Test | Interval | |------+----------| | 0 | SS | | 1 | SS | | 2 | SS | | 3 | SS | | 4 | SS | | 5 | AP | | 6 | AP | | 7 | NT | | 8 | NT | | 9 | SB | | | NP | | | NP | | | NP | #+TBLFM: $2='(test-to-interval $1)